Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: LayoutTests/inspector/documentation/documentation-test.js

Issue 559423004: DevTools: [Documentation] Disable external XHR requests in documentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector/documentation/documentation-url-provider.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 function initialize_DocumentationTests()
2 {
3
4 InspectorTest.mockLoadXHR = function(urlPrefix, responseText)
5 {
6 window.loadXHR = function(url)
7 {
8 return new Promise(load);
lushnikov 2014/09/12 10:47:20 you want to discretely fall-back to the original l
9
10 function load(successCallback, failureCallback)
11 {
12 function onReadyStateChanged()
13 {
14 if (xhr.readyState !== XMLHttpRequest.DONE)
15 return;
16 if (xhr.status !== 200) {
17 xhr.onreadystatechange = null;
18 failureCallback(new Error(xhr.status));
19 return;
20 }
21 xhr.onreadystatechange = null;
22 successCallback(xhr.responseText);
23 }
24
25 if (url.startsWith(urlPrefix)) {
26 successCallback(responseText);
27 return;
28 }
29
30 var xhr = new XMLHttpRequest();
31 xhr.open("GET", url, true);
32 xhr.onreadystatechange = onReadyStateChanged;
33 xhr.send(null);
34 }
35 }
36 }
37
38 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/documentation/documentation-url-provider.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698