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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-test.js

Issue 2738033002: DevTools: add more tests to fixate bindings behavior (Closed)
Patch Set: rebaseline Created 3 years, 9 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
OLDNEW
1 var initialize_BindingsTest = function() { 1 var initialize_BindingsTest = function() {
2 2
3 InspectorTest.preloadModule("sources"); 3 InspectorTest.preloadModule("sources");
4 4
5 InspectorTest.dumpWorkspace = function() { 5 InspectorTest.dumpWorkspace = function(previousSnapshot) {
6 var uiSourceCodes = Workspace.workspace.uiSourceCodes().slice(); 6 var uiSourceCodes = Workspace.workspace.uiSourceCodes().slice();
7 var urls = uiSourceCodes.map(code => code.url()); 7 var urls = uiSourceCodes.map(code => code.url());
8 urls = urls.map(url => { 8 urls = urls.map(url => {
9 if (!url.startsWith('debugger://')) 9 if (!url.startsWith('debugger://'))
10 return url; 10 return url;
11 return url.replace(/VM\d+/g, 'VM[XXX]'); 11 return url.replace(/VM\d+/g, 'VM[XXX]');
12 }); 12 });
13 13
14 urls.sort(String.caseInsensetiveComparator); 14 urls.sort(String.caseInsensetiveComparator);
15 var isAdded = new Array(urls.length).fill(false);
16 var removedLines = [];
17 if (previousSnapshot) {
18 var diff = Diff.Diff.lineDiff(previousSnapshot, urls);
19 var removedEntries = diff.filter(entry => entry[0] === Diff.Diff.Operati on.Delete).map(entry => entry[1]);
20 removedLines = [].concat.apply([], removedEntries);
21 var index = 0;
22 for (var entry of diff) {
23 if (entry[0] === Diff.Diff.Operation.Delete)
24 continue;
25 if (entry[0] === Diff.Diff.Operation.Equal) {
26 index += entry[1].length;
27 continue;
28 }
29 for (var line of entry[1])
30 isAdded[index++] = true;
31 }
32 var addedEntries = diff.filter(entry => entry[0] === Diff.Diff.Operation .Insert).map(entry => entry[1]);
33 addedLines = [].concat.apply([], addedEntries);
34 }
35
36 InspectorTest.addResult(`Removed: ${removedLines.length} uiSourceCodes`);
37 for (var url of removedLines)
38 InspectorTest.addResult('[-] ' + url);
15 InspectorTest.addResult(`Workspace: ${urls.length} uiSourceCodes.`); 39 InspectorTest.addResult(`Workspace: ${urls.length} uiSourceCodes.`);
16 for (var url of urls) { 40 for (var i = 0; i < urls.length; ++i) {
17 InspectorTest.addResult(' ' + url); 41 var url = urls[i];
42 var prefix = isAdded[i] ? '[+] ' : ' ';
43 InspectorTest.addResult(prefix + url);
18 } 44 }
45 return urls;
19 } 46 }
20 47
21 InspectorTest.attachFrame = function(frameId, url, evalSourceURL) { 48 InspectorTest.attachFrame = function(frameId, url, evalSourceURL) {
22 var evalSource = `(${attachFrame.toString()})('${frameId}', '${url}')`; 49 var evalSource = `(${attachFrame.toString()})('${frameId}', '${url}')`;
23 if (evalSourceURL) 50 if (evalSourceURL)
24 evalSource += '//# sourceURL=' + evalSourceURL; 51 evalSource += '//# sourceURL=' + evalSourceURL;
25 return InspectorTest.evaluateInPageAsync(evalSource); 52 return InspectorTest.evaluateInPageAsync(evalSource);
26 53
27 function attachFrame(frameId, url) { 54 function attachFrame(frameId, url) {
28 var frame = document.createElement('iframe'); 55 var frame = document.createElement('iframe');
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 InspectorTest.waitForSourceMap = function(sourceMapURLSuffix) { 105 InspectorTest.waitForSourceMap = function(sourceMapURLSuffix) {
79 var fulfill; 106 var fulfill;
80 var promise = new Promise(x => fulfill = x); 107 var promise = new Promise(x => fulfill = x);
81 sourceMapCallbacks.set(sourceMapURLSuffix, fulfill); 108 sourceMapCallbacks.set(sourceMapURLSuffix, fulfill);
82 return promise; 109 return promise;
83 } 110 }
84 111
85 112
86 } 113 }
87 114
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698