Chromium Code Reviews| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 break; | 107 break; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 var dummyFrontendURL = scriptUrlBasePath + "/resources/protocol-test.html"; | 111 var dummyFrontendURL = scriptUrlBasePath + "/resources/protocol-test.html"; |
| 112 testRunner.showWebInspector("", dummyFrontendURL); | 112 testRunner.showWebInspector("", dummyFrontendURL); |
| 113 // FIXME: rename this 'test' global field across all tests. | 113 // FIXME: rename this 'test' global field across all tests. |
| 114 var testFunction = window.test; | 114 var testFunction = window.test; |
| 115 if (typeof testFunction === "function") { | 115 if (typeof testFunction === "function") { |
| 116 var initializers = ""; | 116 var initializers = ""; |
| 117 var common = ""; | |
| 117 for (var symbol in window) { | 118 for (var symbol in window) { |
| 118 if (!/^initialize_/.test(symbol) || typeof window[symbol] !== "funct ion") | 119 if (typeof window[symbol] !== "function") |
| 119 continue; | 120 continue; |
| 120 initializers += "(" + window[symbol].toString() + ")();\n"; | 121 if (/^initialize_/.test(symbol)) |
| 122 initializers += "(" + window[symbol].toString() + ")();\n"; | |
| 123 else if (/^common_/.test(symbol)) | |
|
pfeldman
2015/04/28 15:49:36
Revert this, use initialize
aboxhall
2015/04/28 16:00:03
Note that this isn't using an IIFE, so initialize
aboxhall
2015/04/28 18:14:20
Done.
| |
| 124 common += window[symbol].toString() + "\n"; | |
| 121 } | 125 } |
| 122 evaluateInFrontend(initializers + "(" + testFunction.toString() +")();") ; | 126 evaluateInFrontend(initializers + common + "(" + testFunction.toString() +")();"); |
| 123 return; | 127 return; |
| 124 } | 128 } |
| 125 // Kill waiting process if failed to send. | 129 // Kill waiting process if failed to send. |
| 126 alert("Failed to send test function"); | 130 alert("Failed to send test function"); |
| 127 testRunner.notifyDone(); | 131 testRunner.notifyDone(); |
| 128 } | 132 } |
| OLD | NEW |