| 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
|
| + };
|
| +});
|
|
|