OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 time | 5 import time |
6 | 6 |
7 from battor import battor_wrapper | 7 from battor import battor_wrapper |
8 from telemetry import decorators | 8 from telemetry import decorators |
9 from telemetry.core import platform as platform_module | 9 from telemetry.core import platform as platform_module |
10 from telemetry.testing import browser_test_case | 10 from telemetry.testing import browser_test_case |
(...skipping 11 matching lines...) Expand all Loading... |
22 config = tracing_config.TracingConfig() | 22 config = tracing_config.TracingConfig() |
23 config.enable_chrome_trace = True | 23 config.enable_chrome_trace = True |
24 tracing_controller.StartTracing(config) | 24 tracing_controller.StartTracing(config) |
25 | 25 |
26 self.Navigate('blank.html') | 26 self.Navigate('blank.html') |
27 | 27 |
28 def _FakeStopChromeTracing(*args): | 28 def _FakeStopChromeTracing(*args): |
29 del args # Unused | 29 del args # Unused |
30 raise Exception('Intentional Tracing Exception') | 30 raise Exception('Intentional Tracing Exception') |
31 | 31 |
32 self._tab._inspector_backend._devtools_client.StopChromeTracing = ( | 32 self._tab._inspector_backend._devtools_client.StopChromeTracing = ( \ |
33 _FakeStopChromeTracing) | 33 _FakeStopChromeTracing) |
34 with self.assertRaisesRegexp(Exception, 'Intentional Tracing Exception'): | 34 with self.assertRaisesRegexp(Exception, 'Intentional Tracing Exception'): |
35 tracing_controller.StopTracing() | 35 tracing_controller.StopTracing() |
36 | 36 |
37 # Tracing is stopped even if there is exception. | 37 # Tracing is stopped even if there is exception. |
38 self.assertFalse(tracing_controller.is_tracing_running) | 38 self.assertFalse(tracing_controller.is_tracing_running) |
39 | 39 |
40 | 40 |
41 @decorators.Isolated | 41 @decorators.Isolated |
42 def testGotTrace(self): | 42 def testGotTrace(self): |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 tracing_controller = self._browser.platform.tracing_controller | 178 tracing_controller = self._browser.platform.tracing_controller |
179 config = tracing_config.TracingConfig() | 179 config = tracing_config.TracingConfig() |
180 config.enable_battor_trace = True | 180 config.enable_battor_trace = True |
181 tracing_controller.StartTracing(config) | 181 tracing_controller.StartTracing(config) |
182 # We wait 1s before starting and stopping tracing to avoid crbug.com/602266, | 182 # We wait 1s before starting and stopping tracing to avoid crbug.com/602266, |
183 # which would cause a crash otherwise. | 183 # which would cause a crash otherwise. |
184 time.sleep(1) | 184 time.sleep(1) |
185 trace_data = tracing_controller.StopTracing() | 185 trace_data = tracing_controller.StopTracing() |
186 self.assertTrue( | 186 self.assertTrue( |
187 trace_data.HasTracesFor(trace_data_module.BATTOR_TRACE_PART)) | 187 trace_data.HasTracesFor(trace_data_module.BATTOR_TRACE_PART)) |
OLD | NEW |