Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/test/functional/tracing/tracing_test.py

Issue 10736055: Smoke test for tracing infrastructure in PyAuto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use argument slices rather than explicit argument lists where appropriate. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6 import uuid
7
8 import pyauto_tracing
9 import pyauto
10
11 from timeline_model import TimelineModel
12 from tracing_js_executor import TracingJsExecutor
13
14 class TracingTest(pyauto.PyUITest):
15 def setUp(self):
16 super(TracingTest, self).setUp()
17 self._trace_win = self.GetBrowserWindowCount() - 1
18 old_tab = self.GetActiveTabIndex(self._trace_win)
19 self.AppendTab('chrome://tracing', self._trace_win)
20 self._trace_tab = self.GetActiveTabIndex(self._trace_win)
21 self.GetBrowserWindow(self._trace_win).ActivateTab(old_tab)
22 self._js_executor = TracingJsExecutor(
nduca 2012/07/20 07:13:13 I'm not clear we need an executor. Why not just pu
23 js_host = self,
24 win_idx = self._trace_win,
25 tab_idx = self._trace_tab
26 )
27 # TODO(nduca): I'm not happy with importing timeline_model_decorator.js
28 # here. I'd rather pull it in from within TimelineModelProxy.
29 # tracing_test.js depends on timeline_model_decorator.js however.
30 self._js_executor.ExecuteJavascriptFile("timeline_model_decorator.js")
31 self._js_executor.ExecuteJavascriptFile("tracing_test.js")
32 self._uuid = uuid.uuid4()
33
34 def tearDown(self):
35 self.GetBrowserWindow(self._trace_win).GetTab(self._trace_tab).Close()
36 super(TracingTest, self).tearDown()
37
38 def BeginTracing(self, system_tracing = True):
39 self._js_executor.ExecuteJavascript(
40 """
41 window.domAutomationController.send(
42 window.pyautoRecordTrace(%s, '%s')
43 );
44 """ % (
45 "true" if system_tracing else "false",
46 str(self._uuid)
47 )
48 )
49
50 def EndTracing(self):
51 uuid = self._js_executor.ExecuteJavascript(
nduca 2012/07/20 07:13:13 Let javascript come up with its own id, rather tha
52 """tracingController.endTracing();"""
53 )
54 return TimelineModel(
55 js_executor = self._js_executor,
56 uuid = uuid
57 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698