Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import shutil | 5 import shutil |
| 6 | 6 |
| 7 from profile_creators import profile_generator | 7 from profile_creators import profile_generator |
| 8 from telemetry.page import page as page_module | 8 from telemetry.page import page as page_module |
| 9 from telemetry.page import cache_temperature as cache_temperature_module | |
| 9 from telemetry.page import shared_page_state | 10 from telemetry.page import shared_page_state |
| 10 from telemetry import story | 11 from telemetry import story |
| 11 | 12 |
| 12 | 13 |
| 13 class Typical25ProfileSharedState(shared_page_state.SharedDesktopPageState): | 14 class Typical25ProfileSharedState(shared_page_state.SharedDesktopPageState): |
| 14 """Shared state associated with a profile generated from 25 navigations. | 15 """Shared state associated with a profile generated from 25 navigations. |
| 15 | 16 |
| 16 Generates a shared profile on initialization. | 17 Generates a shared profile on initialization. |
| 17 """ | 18 """ |
| 18 | 19 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 32 def TearDownState(self): | 33 def TearDownState(self): |
| 33 """Clean up generated profile directory.""" | 34 """Clean up generated profile directory.""" |
| 34 super(Typical25ProfileSharedState, self).TearDownState() | 35 super(Typical25ProfileSharedState, self).TearDownState() |
| 35 if self._owns_out_dir: | 36 if self._owns_out_dir: |
| 36 shutil.rmtree(self._out_dir) | 37 shutil.rmtree(self._out_dir) |
| 37 | 38 |
| 38 | 39 |
| 39 class Typical25Page(page_module.Page): | 40 class Typical25Page(page_module.Page): |
| 40 | 41 |
| 41 def __init__(self, url, page_set, run_no_page_interactions, | 42 def __init__(self, url, page_set, run_no_page_interactions, |
| 42 shared_page_state_class=shared_page_state.SharedDesktopPageState): | 43 shared_page_state_class=shared_page_state.SharedDesktopPageState, |
| 44 cache_temperature=None): | |
| 43 super(Typical25Page, self).__init__( | 45 super(Typical25Page, self).__init__( |
| 44 url=url, page_set=page_set, | 46 url=url, page_set=page_set, |
| 45 shared_page_state_class=shared_page_state_class) | 47 shared_page_state_class=shared_page_state_class, |
| 48 cache_temperature=cache_temperature) | |
| 46 self._run_no_page_interactions = run_no_page_interactions | 49 self._run_no_page_interactions = run_no_page_interactions |
| 47 | 50 |
| 48 def RunPageInteractions(self, action_runner): | 51 def RunPageInteractions(self, action_runner): |
| 49 if self._run_no_page_interactions: | 52 if self._run_no_page_interactions: |
| 50 return | 53 return |
| 51 with action_runner.CreateGestureInteraction('ScrollAction'): | 54 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 52 action_runner.ScrollPage() | 55 action_runner.ScrollPage() |
| 53 | 56 |
| 54 | 57 |
| 55 class Typical25PageSet(story.StorySet): | 58 class Typical25PageSet(story.StorySet): |
| 56 | 59 |
| 57 """ Pages designed to represent the median, not highly optimized web """ | 60 """ Pages designed to represent the median, not highly optimized web """ |
| 58 | 61 |
| 59 def __init__(self, run_no_page_interactions=False, | 62 def __init__(self, run_no_page_interactions=False, |
| 60 page_class=Typical25Page): | 63 page_class=Typical25Page, |
| 64 cache_temperatures=None): | |
| 61 super(Typical25PageSet, self).__init__( | 65 super(Typical25PageSet, self).__init__( |
| 62 archive_data_file='data/typical_25.json', | 66 archive_data_file='data/typical_25.json', |
| 63 cloud_storage_bucket=story.PARTNER_BUCKET) | 67 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 68 if cache_temperatures is None: | |
| 69 cache_temperatures = [cache_temperature_module.ANY] | |
| 64 | 70 |
| 65 urls_list = [ | 71 urls_list = [ |
| 66 # Why: Alexa games #48 | 72 # Why: Alexa games #48 |
| 67 'http://www.nick.com/games', | 73 'http://www.nick.com/games', |
| 68 # Why: Alexa sports #45 | 74 # Why: Alexa sports #45 |
| 69 'http://www.rei.com/', | 75 'http://www.rei.com/', |
| 70 # Why: Alexa sports #50 | 76 # Why: Alexa sports #50 |
| 71 'http://www.fifa.com/', | 77 'http://www.fifa.com/', |
| 72 # Why: Alexa shopping #41 | 78 # Why: Alexa shopping #41 |
| 73 'http://www.gamestop.com/ps3', | 79 'http://www.gamestop.com/ps3', |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 97 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), | 103 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), |
| 98 # pylint: disable=line-too-long | 104 # pylint: disable=line-too-long |
| 99 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-i n-the-world', | 105 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-i n-the-world', |
| 100 'http://www.airbnb.com/', | 106 'http://www.airbnb.com/', |
| 101 'http://www.ign.com/', | 107 'http://www.ign.com/', |
| 102 # Why: Alexa health #25 | 108 # Why: Alexa health #25 |
| 103 'http://www.fda.gov', | 109 'http://www.fda.gov', |
| 104 ] | 110 ] |
| 105 | 111 |
| 106 for url in urls_list: | 112 for url in urls_list: |
| 107 self.AddStory( | 113 for temp in cache_temperatures: |
| 108 page_class(url, self, run_no_page_interactions)) | 114 self.AddStory(page_class( |
| 115 url, self, run_no_page_interactions, cache_temperature=temp)) | |
|
nednguyen
2016/05/13 03:43:22
I don't remember whether we concatenate the cache
eakuefner
2016/05/16 18:27:13
When PageTestResults.AddValue is called, all the s
| |
| OLD | NEW |