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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 function prepareForReload() | 130 function prepareForReload() |
131 { | 131 { |
132 window.location += "#" + reloadParam + lastFrontendEvalId; | 132 window.location += "#" + reloadParam + lastFrontendEvalId; |
133 } | 133 } |
134 | 134 |
135 function openInspector() | 135 function openInspector() |
136 { | 136 { |
137 var scriptTags = document.getElementsByTagName("script"); | 137 var scriptTags = document.getElementsByTagName("script"); |
138 var scriptUrlBasePath = ""; | 138 var scriptUrlBasePath = ""; |
139 for (var i = 0; i < scriptTags.length; ++i) { | 139 for (var i = 0; i < scriptTags.length; ++i) { |
140 var index = scriptTags[i].src.lastIndexOf("/inspector-protocol-test.js")
; | 140 var index = scriptTags[i].src.lastIndexOf("/resources/inspector-protocol
-test.js"); |
141 if (index > -1 ) { | 141 if (index > -1 ) { |
142 scriptUrlBasePath = scriptTags[i].src.slice(0, index); | 142 scriptUrlBasePath = scriptTags[i].src.slice(0, index); |
143 break; | 143 break; |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 var dummyFrontendURL = scriptUrlBasePath + "/resources/protocol-test.html"; | 147 var dummyFrontendURL = scriptUrlBasePath + "/resources/protocol-test.html"; |
148 testRunner.showWebInspector("", dummyFrontendURL); | 148 testRunner.showWebInspector("", dummyFrontendURL); |
149 // FIXME: rename this 'test' global field across all tests. | 149 // FIXME: rename this 'test' global field across all tests. |
150 var testFunction = window.test; | 150 var testFunction = window.test; |
151 if (typeof testFunction === "function") { | 151 if (typeof testFunction === "function") { |
152 var initializers = ""; | 152 var initializers = ""; |
153 for (var symbol in window) { | 153 for (var symbol in window) { |
154 if (!/^initialize_/.test(symbol) || typeof window[symbol] !== "funct
ion") | 154 if (!/^initialize_/.test(symbol) || typeof window[symbol] !== "funct
ion") |
155 continue; | 155 continue; |
156 initializers += "(" + window[symbol].toString() + ")();\n"; | 156 initializers += "(" + window[symbol].toString() + ")();\n"; |
157 } | 157 } |
158 evaluateInFrontend(initializers + "(" + testFunction.toString() +")();")
; | 158 evaluateInFrontend(initializers + "(" + testFunction.toString() +")();")
; |
159 return; | 159 return; |
160 } | 160 } |
161 // Kill waiting process if failed to send. | 161 // Kill waiting process if failed to send. |
162 alert("Failed to send test function"); | 162 alert("Failed to send test function"); |
163 testRunner.notifyDone(); | 163 testRunner.notifyDone(); |
164 } | 164 } |
OLD | NEW |