| 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 os | 5 import os |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 from telemetry import benchmark | 8 from telemetry import benchmark |
| 9 from telemetry import record_wpr | 9 from telemetry import record_wpr |
| 10 from telemetry.core import util | 10 from telemetry.core import util |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 self.func_calls.append('DidStartBrowser') | 65 self.func_calls.append('DidStartBrowser') |
| 66 | 66 |
| 67 class MockBenchmark(benchmark.Benchmark): | 67 class MockBenchmark(benchmark.Benchmark): |
| 68 test = MockPageTest | 68 test = MockPageTest |
| 69 mock_page_set = None | 69 mock_page_set = None |
| 70 | 70 |
| 71 @classmethod | 71 @classmethod |
| 72 def AddBenchmarkCommandLineArgs(cls, group): | 72 def AddBenchmarkCommandLineArgs(cls, group): |
| 73 group.add_option('', '--mock-benchmark-url', action='store', type='string') | 73 group.add_option('', '--mock-benchmark-url', action='store', type='string') |
| 74 | 74 |
| 75 def CreatePageSet(self, options): | 75 def CreateStorySet(self, options): |
| 76 kwargs = {} | 76 kwargs = {} |
| 77 if options.mock_benchmark_url: | 77 if options.mock_benchmark_url: |
| 78 kwargs['url'] = options.mock_benchmark_url | 78 kwargs['url'] = options.mock_benchmark_url |
| 79 self.mock_page_set = MockPageSet(**kwargs) | 79 self.mock_page_set = MockPageSet(**kwargs) |
| 80 return self.mock_page_set | 80 return self.mock_page_set |
| 81 | 81 |
| 82 | 82 |
| 83 class RecordWprUnitTests(tab_test_case.TabTestCase): | 83 class RecordWprUnitTests(tab_test_case.TabTestCase): |
| 84 | 84 |
| 85 _base_dir = util.GetUnittestDataDir() | 85 _base_dir = util.GetUnittestDataDir() |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 record_page_test.page_test = MockBenchmark().test() | 187 record_page_test.page_test = MockBenchmark().test() |
| 188 wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, MockBenchmark(), | 188 wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, MockBenchmark(), |
| 189 flags) | 189 flags) |
| 190 record_page_test.CustomizeBrowserOptions(wpr_recorder.options) | 190 record_page_test.CustomizeBrowserOptions(wpr_recorder.options) |
| 191 record_page_test.WillStartBrowser(self._tab.browser.platform) | 191 record_page_test.WillStartBrowser(self._tab.browser.platform) |
| 192 record_page_test.DidStartBrowser(self._tab.browser) | 192 record_page_test.DidStartBrowser(self._tab.browser) |
| 193 self.assertTrue( | 193 self.assertTrue( |
| 194 'CustomizeBrowserOptions' in record_page_test.page_test.func_calls) | 194 'CustomizeBrowserOptions' in record_page_test.page_test.func_calls) |
| 195 self.assertTrue('WillStartBrowser' in record_page_test.page_test.func_calls) | 195 self.assertTrue('WillStartBrowser' in record_page_test.page_test.func_calls) |
| 196 self.assertTrue('DidStartBrowser' in record_page_test.page_test.func_calls) | 196 self.assertTrue('DidStartBrowser' in record_page_test.page_test.func_calls) |
| OLD | NEW |