| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 2 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 * @param {string} scriptName | 221 * @param {string} scriptName |
| 222 */ | 222 */ |
| 223 InspectorTest.importScript = function(scriptName) | 223 InspectorTest.importScript = function(scriptName) |
| 224 { | 224 { |
| 225 var xhr = new XMLHttpRequest(); | 225 var xhr = new XMLHttpRequest(); |
| 226 xhr.open("GET", scriptName, false); | 226 xhr.open("GET", scriptName, false); |
| 227 xhr.send(null); | 227 xhr.send(null); |
| 228 window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName); | 228 window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName); |
| 229 } | 229 } |
| 230 | 230 |
| 231 InspectorTest.sendCommandAndBailOnError = function(command, properties, callback
) { |
| 232 InspectorTest.sendCommand(command, properties || {}, commandCallback); |
| 233 function commandCallback(msg) |
| 234 { |
| 235 if (msg.error) { |
| 236 InspectorTest.log("ERROR: " + msg.error.message); |
| 237 InspectorTest.completeTest(); |
| 238 return; |
| 239 } |
| 240 if (callback) |
| 241 callback(msg.result); |
| 242 } |
| 243 } |
| 244 |
| 231 window.addEventListener("message", function(event) { | 245 window.addEventListener("message", function(event) { |
| 232 try { | 246 try { |
| 233 eval(event.data); | 247 eval(event.data); |
| 234 } catch (e) { | 248 } catch (e) { |
| 235 alert(e.stack); | 249 alert(e.stack); |
| 236 InspectorTest.completeTest(); | 250 InspectorTest.completeTest(); |
| 237 throw e; | 251 throw e; |
| 238 } | 252 } |
| 239 }); | 253 }); |
| 254 |
| 255 InspectorTest.runTestSuite = function(testSuite) |
| 256 { |
| 257 function nextTest() |
| 258 { |
| 259 if (!testSuite.length) { |
| 260 InspectorTest.completeTest(); |
| 261 return; |
| 262 } |
| 263 var fun = testSuite.shift(); |
| 264 InspectorTest.log("\nRunning test: " + fun.name); |
| 265 fun.call(null, nextTest); |
| 266 } |
| 267 |
| 268 nextTest(); |
| 269 } |
| OLD | NEW |