| 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 | |
| 10 from telemetry.page import shared_page_state | 9 from telemetry.page import shared_page_state |
| 11 from telemetry import story | 10 from telemetry import story |
| 12 | 11 |
| 13 | 12 |
| 14 class Typical25ProfileSharedState(shared_page_state.SharedDesktopPageState): | 13 class Typical25ProfileSharedState(shared_page_state.SharedDesktopPageState): |
| 15 """Shared state associated with a profile generated from 25 navigations. | 14 """Shared state associated with a profile generated from 25 navigations. |
| 16 | 15 |
| 17 Generates a shared profile on initialization. | 16 Generates a shared profile on initialization. |
| 18 """ | 17 """ |
| 19 | 18 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 def TearDownState(self): | 32 def TearDownState(self): |
| 34 """Clean up generated profile directory.""" | 33 """Clean up generated profile directory.""" |
| 35 super(Typical25ProfileSharedState, self).TearDownState() | 34 super(Typical25ProfileSharedState, self).TearDownState() |
| 36 if self._owns_out_dir: | 35 if self._owns_out_dir: |
| 37 shutil.rmtree(self._out_dir) | 36 shutil.rmtree(self._out_dir) |
| 38 | 37 |
| 39 | 38 |
| 40 class Typical25Page(page_module.Page): | 39 class Typical25Page(page_module.Page): |
| 41 | 40 |
| 42 def __init__(self, url, page_set, run_no_page_interactions, | 41 def __init__(self, url, page_set, run_no_page_interactions, |
| 43 shared_page_state_class=shared_page_state.SharedDesktopPageState, | 42 shared_page_state_class=shared_page_state.SharedDesktopPageState): |
| 44 cache_temperature=None): | |
| 45 super(Typical25Page, self).__init__( | 43 super(Typical25Page, self).__init__( |
| 46 url=url, page_set=page_set, | 44 url=url, page_set=page_set, |
| 47 shared_page_state_class=shared_page_state_class, | 45 shared_page_state_class=shared_page_state_class) |
| 48 cache_temperature=cache_temperature) | |
| 49 self._run_no_page_interactions = run_no_page_interactions | 46 self._run_no_page_interactions = run_no_page_interactions |
| 50 | 47 |
| 51 def RunPageInteractions(self, action_runner): | 48 def RunPageInteractions(self, action_runner): |
| 52 if self._run_no_page_interactions: | 49 if self._run_no_page_interactions: |
| 53 return | 50 return |
| 54 with action_runner.CreateGestureInteraction('ScrollAction'): | 51 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 55 action_runner.ScrollPage() | 52 action_runner.ScrollPage() |
| 56 | 53 |
| 57 | 54 |
| 58 class Typical25PageSet(story.StorySet): | 55 class Typical25PageSet(story.StorySet): |
| 59 | 56 |
| 60 """ Pages designed to represent the median, not highly optimized web """ | 57 """ Pages designed to represent the median, not highly optimized web """ |
| 61 | 58 |
| 62 def __init__(self, run_no_page_interactions=False, | 59 def __init__(self, run_no_page_interactions=False, |
| 63 page_class=Typical25Page, | 60 page_class=Typical25Page): |
| 64 cache_temperatures=None): | |
| 65 super(Typical25PageSet, self).__init__( | 61 super(Typical25PageSet, self).__init__( |
| 66 archive_data_file='data/typical_25.json', | 62 archive_data_file='data/typical_25.json', |
| 67 cloud_storage_bucket=story.PARTNER_BUCKET) | 63 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 68 if cache_temperatures is None: | |
| 69 cache_temperatures = [cache_temperature_module.ANY] | |
| 70 | 64 |
| 71 urls_list = [ | 65 urls_list = [ |
| 72 # Why: Alexa games #48 | 66 # Why: Alexa games #48 |
| 73 'http://www.nick.com/games', | 67 'http://www.nick.com/games', |
| 74 # Why: Alexa sports #45 | 68 # Why: Alexa sports #45 |
| 75 'http://www.rei.com/', | 69 'http://www.rei.com/', |
| 76 # Why: Alexa sports #50 | 70 # Why: Alexa sports #50 |
| 77 'http://www.fifa.com/', | 71 'http://www.fifa.com/', |
| 78 # Why: Alexa shopping #41 | 72 # Why: Alexa shopping #41 |
| 79 'http://www.gamestop.com/ps3', | 73 'http://www.gamestop.com/ps3', |
| (...skipping 23 matching lines...) Expand all Loading... |
| 103 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), | 97 '1837448?brand=none&tm_link=tm_homeA_rc_name2'), |
| 104 # pylint: disable=line-too-long | 98 # pylint: disable=line-too-long |
| 105 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-i
n-the-world', | 99 'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-i
n-the-world', |
| 106 'http://www.airbnb.com/', | 100 'http://www.airbnb.com/', |
| 107 'http://www.ign.com/', | 101 'http://www.ign.com/', |
| 108 # Why: Alexa health #25 | 102 # Why: Alexa health #25 |
| 109 'http://www.fda.gov', | 103 'http://www.fda.gov', |
| 110 ] | 104 ] |
| 111 | 105 |
| 112 for url in urls_list: | 106 for url in urls_list: |
| 113 for temp in cache_temperatures: | 107 self.AddStory( |
| 114 self.AddStory(page_class( | 108 page_class(url, self, run_no_page_interactions)) |
| 115 url, self, run_no_page_interactions, cache_temperature=temp)) | |
| OLD | NEW |