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 |
11 from telemetry.testing import simple_mock | 11 from telemetry.testing import simple_mock |
12 | 12 |
13 from measurements import page_cycler | 13 from measurements import page_cycler |
14 from metrics import keychain_metric | 14 from metrics import keychain_metric |
15 | 15 |
16 | 16 |
17 # Allow testing protected members in the unit test. | 17 # Allow testing protected members in the unit test. |
18 # pylint: disable=W0212 | 18 # pylint: disable=protected-access |
19 | 19 |
20 class MockMemoryMetric(object): | 20 class MockMemoryMetric(object): |
21 """Used instead of simple_mock.MockObject so that the precise order and | 21 """Used instead of simple_mock.MockObject so that the precise order and |
22 number of calls need not be specified.""" | 22 number of calls need not be specified.""" |
23 def __init__(self): | 23 def __init__(self): |
24 pass | 24 pass |
25 | 25 |
26 def Start(self, page, tab): | 26 def Start(self, page, tab): |
27 pass | 27 pass |
28 | 28 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 # does an initial navigate to avoid paying for a cross-renderer navigation. | 264 # does an initial navigate to avoid paying for a cross-renderer navigation. |
265 cycler = self.SetUpCycler(setup_memory_module=True) | 265 cycler = self.SetUpCycler(setup_memory_module=True) |
266 pages = [FakePage('file://fakepage1.com'), FakePage('file://fakepage2.com')] | 266 pages = [FakePage('file://fakepage1.com'), FakePage('file://fakepage2.com')] |
267 tab = FakeTab() | 267 tab = FakeTab() |
268 | 268 |
269 self.assertEqual([], tab.navigated_urls) | 269 self.assertEqual([], tab.navigated_urls) |
270 for page in pages * 2: | 270 for page in pages * 2: |
271 cycler.WillNavigateToPage(page, tab) | 271 cycler.WillNavigateToPage(page, tab) |
272 self.assertEqual( | 272 self.assertEqual( |
273 ['http://fakeserver:99999/nonexistent.html'], tab.navigated_urls) | 273 ['http://fakeserver:99999/nonexistent.html'], tab.navigated_urls) |
OLD | NEW |