예제 #1
0
    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.'

        browser_backend = None
        # Note that many profilers doesn't rely on browser_backends, so the number
        # of running_browser_backends may not matter for them.
        if len(self._platform_backend.running_browser_backends) == 1:
            browser_backend = self._platform_backend.running_browser_backends[
                0]
        else:
            raise NotImplementedError()

        profiler_class = profiler_finder.FindProfiler(profiler_name)

        if not profiler_class.is_supported(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(browser_backend, self._platform_backend,
                           base_output_file,
                           self._profilers_states[profiler_class]))
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)
예제 #3
0
def _PrepareFinderOptions(finder_options, test, page_set):
    browser_options = finder_options.browser_options
    # Set up user agent.
    browser_options.browser_user_agent_type = page_set.user_agent_type or None

    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)
예제 #4
0
    def StartProfiling(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.options):
            raise Exception('The %s profiler is not '
                            'supported on this platform.' % profiler_name)

        self._active_profilers.append(
            profiler_class(self._browser_backend, self._platform_backend,
                           base_output_file))
예제 #5
0
  def StartProfiling(self, options, base_output_file):
    """Starts profiling using |options|.profiler_tool. Results are saved to
    |base_output_file|.<process_name>."""
    assert not self._active_profilers

    profiler_class = profiler_finder.FindProfiler(options.profiler_tool)

    if not profiler_class.is_supported(options):
      raise Exception('The %s profiler is not '
                      'supported on this platform.' % options.profiler_tool)

    self._active_profilers.append(
        profiler_class(self._browser_backend, self._platform_backend,
            base_output_file))
def Run(test, page_set, expectations, options):
    """Runs a given test against a given page_set with the given options."""
    results = test.PrepareResults(options)

    # Create a possible_browser with the given options.
    test.CustomizeBrowserOptions(options)
    if options.profiler:
        profiler_class = profiler_finder.FindProfiler(options.profiler)
        profiler_class.CustomizeBrowserOptions(options)
    try:
        possible_browser = browser_finder.FindBrowser(options)
    except browser_finder.BrowserTypeRequiredException, e:
        sys.stderr.write(str(e) + '\n')
        sys.exit(1)
예제 #7
0
      _UpdatePageSetArchivesIfChanged(page_set)
      pages = _CheckArchives(page_set, pages, results)

  # Verify credentials path.
  credentials_path = None
  if page_set.credentials_path:
    credentials_path = os.path.join(os.path.dirname(page_set.file_path),
                                    page_set.credentials_path)
    if not os.path.exists(credentials_path):
      credentials_path = None

  # Set up user agent.
  browser_options.browser_user_agent_type = page_set.user_agent_type or None

  if finder_options.profiler:
    profiler_class = profiler_finder.FindProfiler(finder_options.profiler)
    profiler_class.CustomizeBrowserOptions(browser_options.browser_type,
                                           finder_options)

  for page in list(pages):
    if not test.CanRunForPage(page):
      results.WillRunPage(page)
      logging.debug('Skipping test: it cannot run for %s', page.url)
      results.AddValue(skip.SkipValue(page, 'Test cannot run'))
      results.DidRunPage(page)
      pages.remove(page)

  if not pages:
    return

  state = _RunState()