Exemplo n.º 1
0
def _PrepareFinderOptions(finder_options, test, device_type):
    browser_options = finder_options.browser_options
    # Set up user agent.
    browser_options.browser_user_agent_type = device_type

    test.CustomizeBrowserOptions(finder_options.browser_options)
    if finder_options.profiler:
        profiler_class = profiler_finder.FindProfiler(finder_options.profiler)
        profiler_class.CustomizeBrowserOptions(browser_options.browser_type,
                                               finder_options)
  def Start(self, profiler_name, base_output_file):
    """Starts profiling using |profiler_name|. Results are saved to
    |base_output_file|.<process_name>."""
    assert not self._active_profilers, 'Already profiling. Must stop first.'

    profiler_class = profiler_finder.FindProfiler(profiler_name)

    if not profiler_class.is_supported(self._browser_backend.browser_type):
      raise Exception('The %s profiler is not '
                      'supported on this platform.' % profiler_name)

    if not profiler_class in self._profilers_states:
      self._profilers_states[profiler_class] = {}

    self._active_profilers.append(
        profiler_class(self._browser_backend, self._platform_backend,
            base_output_file, self._profilers_states[profiler_class]))