| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 function $(id) { | 6 function $(id) { |
| 7 return document.getElementById(id); | 7 return document.getElementById(id); |
| 8 } | 8 } |
| 9 | 9 |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 this_.disableRPC(); | 110 this_.disableRPC(); |
| 111 } | 111 } |
| 112 } else { | 112 } else { |
| 113 handleRPCFailure(name, req.status.toString()); | 113 handleRPCFailure(name, req.status.toString()); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Performs a URL-encoded RPC call, given a function name and a dictionary | 117 // Performs a URL-encoded RPC call, given a function name and a dictionary |
| 118 // (actually just an object - it's a JS idiom) of parameters. | 118 // (actually just an object - it's a JS idiom) of parameters. |
| 119 function rpcCall(name, params) { | 119 function rpcCall(name, params) { |
| 120 if (this_.rpc_available) { | 120 if (window.domAutomationController !== undefined) { |
| 121 // Running as a Chrome browser_test. |
| 122 var msg = {type: name}; |
| 123 for (var pname in params) { |
| 124 msg[pname] = params[pname]; |
| 125 } |
| 126 domAutomationController.setAutomationId(0); |
| 127 domAutomationController.send(JSON.stringify(msg)); |
| 128 } else if (this_.rpc_available) { |
| 121 // Construct the URL for the RPC request. | 129 // Construct the URL for the RPC request. |
| 122 var args = []; | 130 var args = []; |
| 123 for (var pname in params) { | 131 for (var pname in params) { |
| 124 pvalue = params[pname]; | 132 pvalue = params[pname]; |
| 125 args.push(encodeURIComponent(pname) + '=' + encodeURIComponent(pvalue)); | 133 args.push(encodeURIComponent(pname) + '=' + encodeURIComponent(pvalue)); |
| 126 } | 134 } |
| 127 var url = '/TESTER/' + name + '?' + args.join('&'); | 135 var url = '/TESTER/' + name + '?' + args.join('&'); |
| 128 var req = new XMLHttpRequest(); | 136 var req = new XMLHttpRequest(); |
| 129 // Async result handler | 137 // Async result handler |
| 130 if (this_.async) { | 138 if (this_.async) { |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 if (this.testCount < tests.length) { | 931 if (this.testCount < tests.length) { |
| 924 if (!parallel) { | 932 if (!parallel) { |
| 925 // Move on to the next test if they're being run one at a time. | 933 // Move on to the next test if they're being run one at a time. |
| 926 this.launchTest(this.testCount); | 934 this.launchTest(this.testCount); |
| 927 } | 935 } |
| 928 } else { | 936 } else { |
| 929 this._done(); | 937 this._done(); |
| 930 } | 938 } |
| 931 } | 939 } |
| 932 } | 940 } |
| OLD | NEW |