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

Unified Diff: chrome/test/functional/tracing/tracer.js

Issue 10736055: Smoke test for tracing infrastructure in PyAuto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more style issues. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/functional/tracing/timeline_model_shim.js ('k') | chrome/test/functional/tracing/tracer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/tracing/tracer.js
diff --git a/chrome/test/functional/tracing/tracer.js b/chrome/test/functional/tracing/tracer.js
new file mode 100644
index 0000000000000000000000000000000000000000..75c43a77eac26b4e2fdb099586cf8e7fcbe492eb
--- /dev/null
+++ b/chrome/test/functional/tracing/tracer.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 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.
+
+window.pyautoRecordTrace = function(systemTracing) {
+ 'use strict';
+ if( window.timelineModelShimId == undefined )
+ window.timelineModelShimId = 0;
+ if( window.timelineModelShims == undefined )
+ window.timelineModelShims = {};
+ var handler = function() {
+ tracingController.removeEventListener('traceEnded', handler);
+ var model = new TimelineModelShim(
+ Array.prototype.slice.call(arguments, 1)
+ );
+ var events = [tracingController.traceEvents_];
+ if (tracingController.supportsSystemTracing)
+ events.push(tracingController.systemTraceEvents_);
+ model.importTraces(events);
+ var shimId = window.timelineModelShimId;
+ window.timelineModelShims[shimId] = model;
+ window.domAutomationController.send(shimId);
+ window.timelineModelShimId++;
+ };
+ tracingController.addEventListener('traceEnded', handler);
+ var willSystemTrace =
+ tracingController.supportsSystemTracing ? systemTracing : false;
+ tracingController.beginTracing(willSystemTrace);
+ return willSystemTrace;
+};
+
+// This causes the PyAuto ExecuteJavascript call which executed this file to
+// return.
+window.domAutomationController.send('');
« no previous file with comments | « chrome/test/functional/tracing/timeline_model_shim.js ('k') | chrome/test/functional/tracing/tracer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698