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.core import util | 9 from telemetry.core import util |
10 from telemetry.core import wpr_modes | 10 from telemetry.core import wpr_modes |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 record_page_test = record_wpr.RecorderPageTest([]) | 131 record_page_test = record_wpr.RecorderPageTest([]) |
132 record_page_test.page_test = MockBenchmark().test() | 132 record_page_test.page_test = MockBenchmark().test() |
133 page = MockPage(page_set=MockPageSet(url=self._url), url=self._url) | 133 page = MockPage(page_set=MockPageSet(url=self._url), url=self._url) |
134 record_page_test.RunPage(page, self._tab, results=None) | 134 record_page_test.RunPage(page, self._tab, results=None) |
135 self.assertEqual(3, len(record_page_test.page_test.func_calls)) | 135 self.assertEqual(3, len(record_page_test.page_test.func_calls)) |
136 self.assertEqual('WillRunActions', record_page_test.page_test.func_calls[0]) | 136 self.assertEqual('WillRunActions', record_page_test.page_test.func_calls[0]) |
137 self.assertEqual('DidRunActions', record_page_test.page_test.func_calls[1]) | 137 self.assertEqual('DidRunActions', record_page_test.page_test.func_calls[1]) |
138 self.assertEqual('ValidatePage', record_page_test.page_test.func_calls[2]) | 138 self.assertEqual('ValidatePage', record_page_test.page_test.func_calls[2]) |
139 | 139 |
140 def testWprRecorderWithPageSet(self): | 140 def testWprRecorderWithPageSet(self): |
| 141 flags = [] |
141 wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, | 142 wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, |
142 MockPageSet(url=self._url)) | 143 MockPageSet(url=self._url), flags) |
143 results = wpr_recorder.Record() | 144 results = wpr_recorder.Record() |
144 self.assertEquals(1, len(results.successes)) | 145 self.assertEquals(1, len(results.successes)) |
145 mock_page = results.successes.pop() | 146 mock_page = results.successes.pop() |
146 self.assertTrue('RunFoo' in mock_page.func_calls) | 147 self.assertTrue('RunFoo' in mock_page.func_calls) |
147 self.assertFalse('RunBaz' in mock_page.func_calls) | 148 self.assertFalse('RunBaz' in mock_page.func_calls) |
148 | 149 |
149 def testWprRecorderWithBenchmark(self): | 150 def testWprRecorderWithBenchmark(self): |
150 flags = ['--mock-benchmark-url', self._url] | 151 flags = ['--mock-benchmark-url', self._url] |
151 wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, MockBenchmark(), | 152 wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, MockBenchmark(), |
152 flags) | 153 flags) |
(...skipping 28 matching lines...) Expand all Loading... |
181 wpr_recorder.options.browser_options.wpr_mode) | 182 wpr_recorder.options.browser_options.wpr_mode) |
182 | 183 |
183 def testFindAllActionNames(self): | 184 def testFindAllActionNames(self): |
184 # The src/tools/telemetry/unittest_data/page_measurements/ has been | 185 # The src/tools/telemetry/unittest_data/page_measurements/ has been |
185 # populated with three simple Page Measurement classes, the first two of | 186 # populated with three simple Page Measurement classes, the first two of |
186 # which have action_name_to_run defined. | 187 # which have action_name_to_run defined. |
187 action_names_to_run = record_wpr.FindAllActionNames(self._test_data_dir) | 188 action_names_to_run = record_wpr.FindAllActionNames(self._test_data_dir) |
188 self.assertTrue('RunFoo' in action_names_to_run) | 189 self.assertTrue('RunFoo' in action_names_to_run) |
189 self.assertTrue('RunBar' in action_names_to_run) | 190 self.assertTrue('RunBar' in action_names_to_run) |
190 self.assertFalse('RunBaz' in action_names_to_run) | 191 self.assertFalse('RunBaz' in action_names_to_run) |
OLD | NEW |