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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-test.js
index 9b49a18dadfc5b51cfcb1e700c50062219871bda..c32efc5af8ae084134e5c381bcb9d4fedb3dfc9c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-test.js
@@ -2,7 +2,7 @@ var initialize_BindingsTest = function() {
InspectorTest.preloadModule("sources");
-InspectorTest.dumpWorkspace = function() {
+InspectorTest.dumpWorkspace = function(previousSnapshot) {
var uiSourceCodes = Workspace.workspace.uiSourceCodes().slice();
var urls = uiSourceCodes.map(code => code.url());
urls = urls.map(url => {
@@ -12,10 +12,37 @@ InspectorTest.dumpWorkspace = function() {
});
urls.sort(String.caseInsensetiveComparator);
+ var isAdded = new Array(urls.length).fill(false);
+ var removedLines = [];
+ if (previousSnapshot) {
+ var diff = Diff.Diff.lineDiff(previousSnapshot, urls);
+ var removedEntries = diff.filter(entry => entry[0] === Diff.Diff.Operation.Delete).map(entry => entry[1]);
+ removedLines = [].concat.apply([], removedEntries);
+ var index = 0;
+ for (var entry of diff) {
+ if (entry[0] === Diff.Diff.Operation.Delete)
+ continue;
+ if (entry[0] === Diff.Diff.Operation.Equal) {
+ index += entry[1].length;
+ continue;
+ }
+ for (var line of entry[1])
+ isAdded[index++] = true;
+ }
+ var addedEntries = diff.filter(entry => entry[0] === Diff.Diff.Operation.Insert).map(entry => entry[1]);
+ addedLines = [].concat.apply([], addedEntries);
+ }
+
+ InspectorTest.addResult(`Removed: ${removedLines.length} uiSourceCodes`);
+ for (var url of removedLines)
+ InspectorTest.addResult('[-] ' + url);
InspectorTest.addResult(`Workspace: ${urls.length} uiSourceCodes.`);
- for (var url of urls) {
- InspectorTest.addResult(' ' + url);
+ for (var i = 0; i < urls.length; ++i) {
+ var url = urls[i];
+ var prefix = isAdded[i] ? '[+] ' : ' ';
+ InspectorTest.addResult(prefix + url);
}
+ return urls;
}
InspectorTest.attachFrame = function(frameId, url, evalSourceURL) {

Powered by Google App Engine
This is Rietveld 408576698