Chromium Code Reviews| Index: chrome/test/data/webui/test_api.js |
| diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js |
| index 2696d2b2ede4376bfb221f5dea68b136a61a4ec0..154b1f01ba11c5d773fbacf72cb02dae7b728592 100644 |
| --- a/chrome/test/data/webui/test_api.js |
| +++ b/chrome/test/data/webui/test_api.js |
| @@ -830,7 +830,12 @@ var testing = {}; |
| } |
| if (!result) |
| result = testResult(); |
| - chrome.send('testResult', result); |
| + if (chrome.send) { |
|
dmazzoni
2014/06/09 06:59:46
I think it'd be more clear if you determined wheth
David Tseng
2014/06/10 05:35:22
There are just two instances with probably no more
|
| + chrome.send('testResult', result); |
| + } else if (window.domAutomationController.send) { |
| + valueResult = { 'result': result[0], message: result[1]}; |
|
Peter Lundblad
2014/06/08 23:27:22
nit: put a space before the last } to be symmetric
David Tseng
2014/06/10 05:35:22
Done.
|
| + window.domAutomationController.send(JSON.stringify(valueResult)); |
| + } |
| errors.splice(0, errors.length); |
| } else { |
| console.warn('testIsDone already'); |
| @@ -1101,6 +1106,12 @@ var testing = {}; |
| // that have enabled content-security-policy. |
| var testBody = this[testFunction]; // global object -- not a method. |
| var testName = testFunction; |
| + |
| + // Depending on how we were called, |this| might not resolve to the global |
| + // context. |
| + if (testName == 'RUN_TEST_F' && testBody === undefined) |
| + testBody = RUN_TEST_F; |
| + |
| if (typeof testBody === "undefined") { |
| testBody = eval(testFunction); |
| testName = testBody.toString(); |