Chromium Code Reviews| Index: chrome/test/functional/tracing/tracing_test.py |
| diff --git a/chrome/test/functional/tracing/tracing_test.py b/chrome/test/functional/tracing/tracing_test.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2559a61533fe74c557678c90eb32e46a63b664ad |
| --- /dev/null |
| +++ b/chrome/test/functional/tracing/tracing_test.py |
| @@ -0,0 +1,57 @@ |
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import unittest |
| +import uuid |
| + |
| +import pyauto_tracing |
| +import pyauto |
| + |
| +from timeline_model import TimelineModel |
| +from tracing_js_executor import TracingJsExecutor |
| + |
| +class TracingTest(pyauto.PyUITest): |
| + def setUp(self): |
| + super(TracingTest, self).setUp() |
| + self._trace_win = self.GetBrowserWindowCount() - 1 |
| + old_tab = self.GetActiveTabIndex(self._trace_win) |
| + self.AppendTab('chrome://tracing', self._trace_win) |
| + self._trace_tab = self.GetActiveTabIndex(self._trace_win) |
| + self.GetBrowserWindow(self._trace_win).ActivateTab(old_tab) |
| + self._js_executor = TracingJsExecutor( |
|
nduca
2012/07/20 07:13:13
I'm not clear we need an executor. Why not just pu
|
| + js_host = self, |
| + win_idx = self._trace_win, |
| + tab_idx = self._trace_tab |
| + ) |
| + # TODO(nduca): I'm not happy with importing timeline_model_decorator.js |
| + # here. I'd rather pull it in from within TimelineModelProxy. |
| + # tracing_test.js depends on timeline_model_decorator.js however. |
| + self._js_executor.ExecuteJavascriptFile("timeline_model_decorator.js") |
| + self._js_executor.ExecuteJavascriptFile("tracing_test.js") |
| + self._uuid = uuid.uuid4() |
| + |
| + def tearDown(self): |
| + self.GetBrowserWindow(self._trace_win).GetTab(self._trace_tab).Close() |
| + super(TracingTest, self).tearDown() |
| + |
| + def BeginTracing(self, system_tracing = True): |
| + self._js_executor.ExecuteJavascript( |
| + """ |
| + window.domAutomationController.send( |
| + window.pyautoRecordTrace(%s, '%s') |
| + ); |
| + """ % ( |
| + "true" if system_tracing else "false", |
| + str(self._uuid) |
| + ) |
| + ) |
| + |
| + def EndTracing(self): |
| + uuid = self._js_executor.ExecuteJavascript( |
|
nduca
2012/07/20 07:13:13
Let javascript come up with its own id, rather tha
|
| + """tracingController.endTracing();""" |
| + ) |
| + return TimelineModel( |
| + js_executor = self._js_executor, |
| + uuid = uuid |
| + ) |