OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 sys | 5 import sys |
6 import unittest | 6 import unittest |
7 | 7 |
8 from telemetry.internal.browser import browser_options | 8 from telemetry.internal.browser import browser_options |
9 from telemetry.internal.results import page_test_results | 9 from telemetry.internal.results import page_test_results |
10 from telemetry.internal import story_runner | 10 from telemetry.internal import story_runner |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 def UrlOf(self, url_path): | 93 def UrlOf(self, url_path): |
94 return 'http://fakeserver:99999/%s' % url_path | 94 return 'http://fakeserver:99999/%s' % url_path |
95 return FakeHttpServer() | 95 return FakeHttpServer() |
96 | 96 |
97 | 97 |
98 class FakePlatform(object): | 98 class FakePlatform(object): |
99 def GetOSName(self): | 99 def GetOSName(self): |
100 return 'fake' | 100 return 'fake' |
101 def CanMonitorPower(self): | 101 def CanMonitorPower(self): |
102 return False | 102 return False |
| 103 def CanMeasureIdleWakeUps(self): |
| 104 return False |
103 | 105 |
104 | 106 |
105 class PageCyclerUnitTest(unittest.TestCase): | 107 class PageCyclerUnitTest(unittest.TestCase): |
106 | 108 |
107 def SetUpCycler(self, page_repeat=1, pageset_repeat=10, cold_load_percent=50, | 109 def SetUpCycler(self, page_repeat=1, pageset_repeat=10, cold_load_percent=50, |
108 report_speed_index=False, setup_memory_module=False): | 110 report_speed_index=False, setup_memory_module=False): |
109 cycler = page_cycler.PageCycler( | 111 cycler = page_cycler.PageCycler( |
110 page_repeat = page_repeat, | 112 page_repeat = page_repeat, |
111 pageset_repeat = pageset_repeat, | 113 pageset_repeat = pageset_repeat, |
112 cold_load_percent = cold_load_percent, | 114 cold_load_percent = cold_load_percent, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 # does an initial navigate to avoid paying for a cross-renderer navigation. | 254 # does an initial navigate to avoid paying for a cross-renderer navigation. |
253 cycler = self.SetUpCycler(setup_memory_module=True) | 255 cycler = self.SetUpCycler(setup_memory_module=True) |
254 pages = [FakePage('file://fakepage1.com'), FakePage('file://fakepage2.com')] | 256 pages = [FakePage('file://fakepage1.com'), FakePage('file://fakepage2.com')] |
255 tab = FakeTab() | 257 tab = FakeTab() |
256 | 258 |
257 self.assertEqual([], tab.navigated_urls) | 259 self.assertEqual([], tab.navigated_urls) |
258 for page in pages * 2: | 260 for page in pages * 2: |
259 cycler.WillNavigateToPage(page, tab) | 261 cycler.WillNavigateToPage(page, tab) |
260 self.assertEqual( | 262 self.assertEqual( |
261 ['http://fakeserver:99999/nonexistent.html'], tab.navigated_urls) | 263 ['http://fakeserver:99999/nonexistent.html'], tab.navigated_urls) |
OLD | NEW |