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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 (window.domAutomationController !== undefined) { | 120 if (window.domAutomationController !== undefined) { |
121 // Running as a Chrome browser_test. | 121 // Running as a Chrome browser_test. |
122 var msg = {type: name}; | 122 var msg = {type: name}; |
123 for (var pname in params) { | 123 for (var pname in params) { |
124 msg[pname] = params[pname]; | 124 msg[pname] = params[pname]; |
125 } | 125 } |
126 domAutomationController.setAutomationId(0); | |
127 domAutomationController.send(JSON.stringify(msg)); | 126 domAutomationController.send(JSON.stringify(msg)); |
128 } else if (this_.rpc_available) { | 127 } else if (this_.rpc_available) { |
129 // Construct the URL for the RPC request. | 128 // Construct the URL for the RPC request. |
130 var args = []; | 129 var args = []; |
131 for (var pname in params) { | 130 for (var pname in params) { |
132 pvalue = params[pname]; | 131 pvalue = params[pname]; |
133 args.push(encodeURIComponent(pname) + '=' + encodeURIComponent(pvalue)); | 132 args.push(encodeURIComponent(pname) + '=' + encodeURIComponent(pvalue)); |
134 } | 133 } |
135 var url = '/TESTER/' + name + '?' + args.join('&'); | 134 var url = '/TESTER/' + name + '?' + args.join('&'); |
136 var req = new XMLHttpRequest(); | 135 var req = new XMLHttpRequest(); |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 if (this.testCount < tests.length) { | 982 if (this.testCount < tests.length) { |
984 if (!parallel) { | 983 if (!parallel) { |
985 // Move on to the next test if they're being run one at a time. | 984 // Move on to the next test if they're being run one at a time. |
986 this.launchTest(this.testCount); | 985 this.launchTest(this.testCount); |
987 } | 986 } |
988 } else { | 987 } else { |
989 this._done(); | 988 this._done(); |
990 } | 989 } |
991 } | 990 } |
992 } | 991 } |
OLD | NEW |