Chromium Code Reviews| Index: LayoutTests/inspector/documentation/documentation-test.js |
| diff --git a/LayoutTests/inspector/documentation/documentation-test.js b/LayoutTests/inspector/documentation/documentation-test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ce5b7b1e1a7d6d2f2d532ceaac63377208792eec |
| --- /dev/null |
| +++ b/LayoutTests/inspector/documentation/documentation-test.js |
| @@ -0,0 +1,38 @@ |
| +function initialize_DocumentationTests() |
| +{ |
| + |
| +InspectorTest.mockLoadXHR = function(urlPrefix, responseText) |
| +{ |
| + window.loadXHR = function(url) |
| + { |
| + return new Promise(load); |
|
lushnikov
2014/09/12 10:47:20
you want to discretely fall-back to the original l
|
| + |
| + function load(successCallback, failureCallback) |
| + { |
| + function onReadyStateChanged() |
| + { |
| + if (xhr.readyState !== XMLHttpRequest.DONE) |
| + return; |
| + if (xhr.status !== 200) { |
| + xhr.onreadystatechange = null; |
| + failureCallback(new Error(xhr.status)); |
| + return; |
| + } |
| + xhr.onreadystatechange = null; |
| + successCallback(xhr.responseText); |
| + } |
| + |
| + if (url.startsWith(urlPrefix)) { |
| + successCallback(responseText); |
| + return; |
| + } |
| + |
| + var xhr = new XMLHttpRequest(); |
| + xhr.open("GET", url, true); |
| + xhr.onreadystatechange = onReadyStateChanged; |
| + xhr.send(null); |
| + } |
| + } |
| +} |
| + |
| +} |