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

Unified Diff: chrome/browser/resources/tracing/test_utils.js

Issue 8513009: Add TRACE_COUNTER support to about:tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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
Index: chrome/browser/resources/tracing/test_utils.js
diff --git a/chrome/browser/resources/tracing/test_utils.js b/chrome/browser/resources/tracing/test_utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..e79189face7e931ce7fc1adb1992f6ffd838e5f0
--- /dev/null
+++ b/chrome/browser/resources/tracing/test_utils.js
@@ -0,0 +1,32 @@
+// 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.
+
+/**
+ * @fileoverview Helper functions for use in tracing tests.
+ */
+cr.define('test_utils', function() {
+ function getJSON(url, cb) {
+ var req = new XMLHttpRequest();
+ req.open('GET', url, true);
+ req.onreadystatechange = function(aEvt) {
+ if (req.readyState == 4) {
+ window.setTimeout(function() {
+ if (req.status == 200) {
+ var resp = JSON.parse(req.responseText);
+ if (resp.traceEvents)
+ cb(resp.traceEvents);
+ else
+ cb(resp);
+ } else {
+ console.log('Failed to load ' + url);
+ }
+ }, 0);
+ }
+ };
+ req.send(null);
+ }
+ return {
+ getJSON: getJSON
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698