| Index: tools/perf/profile_creators/small_profile_creator.py
 | 
| diff --git a/tools/perf/profile_creators/small_profile_creator.py b/tools/perf/profile_creators/small_profile_creator.py
 | 
| index d8bb4532be2c418d257c365283e6d786d340b4b0..46109a7a4f341a536c73cb5e47498f07a2c37085 100644
 | 
| --- a/tools/perf/profile_creators/small_profile_creator.py
 | 
| +++ b/tools/perf/profile_creators/small_profile_creator.py
 | 
| @@ -4,29 +4,58 @@
 | 
|  
 | 
|  from telemetry.page import profile_creator
 | 
|  
 | 
| +import logging
 | 
|  import page_sets
 | 
|  
 | 
| +from telemetry import benchmark
 | 
| +from telemetry.page import page_test
 | 
| +from telemetry.page import test_expectations
 | 
| +from telemetry.results import results_options
 | 
| +from telemetry.user_story import user_story_runner
 | 
| +
 | 
|  
 | 
|  class SmallProfileCreator(profile_creator.ProfileCreator):
 | 
|    """
 | 
|    Runs a browser through a series of operations to fill in a small test profile.
 | 
| +
 | 
| +  This consists of performing a single navigation to each of the top 25 pages.
 | 
|    """
 | 
| +  class PageTest(page_test.PageTest):
 | 
| +    def __init__(self):
 | 
| +      super(SmallProfileCreator.PageTest, self).__init__()
 | 
| +      self._page_set = page_sets.Typical25PageSet()
 | 
| +
 | 
| +      # Open all links in the same tab save for the last _NUM_TABS links which
 | 
| +      # are each opened in a new tab.
 | 
| +      self._NUM_TABS = 5
 | 
| +
 | 
| +    def TabForPage(self, page, browser):
 | 
| +      """Superclass override."""
 | 
| +      idx = page.page_set.pages.index(page)
 | 
| +      # The last _NUM_TABS pages open a new tab.
 | 
| +      if idx <= (len(page.page_set.pages) - self._NUM_TABS):
 | 
| +        return browser.tabs[0]
 | 
| +      else:
 | 
| +        return browser.tabs.New()
 | 
| +
 | 
| +    def ValidateAndMeasurePage(self, page, tab, results):
 | 
| +      """Superclass override."""
 | 
| +      tab.WaitForDocumentReadyStateToBeComplete()
 | 
|  
 | 
|    def __init__(self):
 | 
|      super(SmallProfileCreator, self).__init__()
 | 
| -    self._page_set = page_sets.Typical25PageSet()
 | 
| -
 | 
| -    # Open all links in the same tab save for the last _NUM_TABS links which
 | 
| -    # are each opened in a new tab.
 | 
| -    self._NUM_TABS = 5
 | 
| -
 | 
| -  def TabForPage(self, page, browser):
 | 
| -    idx = page.page_set.pages.index(page)
 | 
| -    # The last _NUM_TABS pages open a new tab.
 | 
| -    if idx <= (len(page.page_set.pages) - self._NUM_TABS):
 | 
| -      return browser.tabs[0]
 | 
| -    else:
 | 
| -      return browser.tabs.New()
 | 
| -
 | 
| -  def ValidateAndMeasurePage(self, _, tab, results):
 | 
| -    tab.WaitForDocumentReadyStateToBeComplete()
 | 
| +    self._page_test = SmallProfileCreator.PageTest()
 | 
| +
 | 
| +  def Run(self, options):
 | 
| +    expectations = test_expectations.TestExpectations()
 | 
| +    results = results_options.CreateResults(
 | 
| +        benchmark.BenchmarkMetadata(profile_creator.__class__.__name__),
 | 
| +        options)
 | 
| +    user_story_runner.Run(self._page_test, self._page_test._page_set,
 | 
| +        expectations, options, results)
 | 
| +
 | 
| +    if results.failures:
 | 
| +      logging.warning('Some pages failed to load.')
 | 
| +      logging.warning('Failed pages:\n%s',
 | 
| +                      '\n'.join(map(str, results.pages_that_failed)))
 | 
| +      raise Exception('SmallProfileCreator failed.')
 | 
| 
 |