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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/isolated-filesystem-test.js

Issue 2418813005: DevTools: [Persistence] implement automapping (Closed)
Patch Set: address comments Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector/isolated-filesystem-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/isolated-filesystem-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/isolated-filesystem-test.js
index 2f1e538f0b1b6a53c854794468309ad58fdebb32..bddcffbb122eb476856ca5848aa2a1fb3be151b7 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/isolated-filesystem-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/isolated-filesystem-test.js
@@ -47,6 +47,29 @@ InspectorTest.TestFileSystem.prototype = {
fileSystemMapping.addFileSystem(this.fileSystemPath);
fileSystemMapping.addFileMapping(this.fileSystemPath, urlPrefix, pathPrefix);
WebInspector.fileSystemMapping._loadFromSettings();
+ },
+
+ /**
+ * @param {string} path
+ * @param {string} content
+ * @param {number} lastModified
+ */
+ addFile: function(path, content, lastModified)
+ {
+ var pathTokens = path.split("/");
+ var node = this.root;
+ var folders = pathTokens.slice(0, pathTokens.length - 1);
+ var fileName = pathTokens.peekLast();
+ for (var folder of folders) {
+ var dir = node._childrenMap[folder];
+ if (!dir)
+ dir = node.mkdir(folder);
+ node = dir;
+ }
+ var file = node.addFile(fileName, content);
+ if (lastModified)
+ file._timestamp = lastModified;
+ return file;
}
}
@@ -103,6 +126,8 @@ InspectorTest.TestFileSystem.Entry.prototype = {
this._children.push(child);
child.parent = this;
child.content = new Blob([content], {type: 'text/plain'});
+ var fullPath = this._fileSystem.fileSystemPath + child.fullPath;
+ InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendHostAPI.Events.FileSystemFilesChanged, [fullPath]);
return child;
},
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698