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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/file-system-project-mapping.html

Issue 2542073002: DevTools: [Persistence] validate persistence binding. (Closed)
Patch Set: rebaseline tests Created 4 years 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/file-system-project-mapping-expected.txt » ('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/file-system-project-mapping.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/file-system-project-mapping.html b/third_party/WebKit/LayoutTests/http/tests/inspector/file-system-project-mapping.html
index d5097ada60b80bfbfff07550144063d23fe887ef..0b715109f55af98459b84eb81c6a690ddd79ab1d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/file-system-project-mapping.html
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/file-system-project-mapping.html
@@ -2,6 +2,7 @@
<head>
<script src="inspector-test.js"></script>
<script src="debugger-test.js"></script>
+<script src="persistence/persistence-test.js"></script>
<script src="isolated-filesystem-test.js"></script>
<script>
function addScript(url)
@@ -14,7 +15,6 @@ function addScript(url)
function test()
{
var target = InspectorTest.mainTarget;
- var persistence = Persistence.persistence;
var fileSystemProjectId = Persistence.FileSystemWorkspaceBinding.projectId("file:///var/www");
function dumpFileSystemUISourceCodesMappings()
@@ -22,78 +22,19 @@ function test()
var uiSourceCodes = Workspace.workspace.project(fileSystemProjectId).uiSourceCodes();
InspectorTest.addResult("UISourceCode uri to url mappings:");
for (var uiSourceCode of uiSourceCodes) {
- var binding = persistence.binding(uiSourceCode);
+ var binding = Persistence.persistence.binding(uiSourceCode);
var url = binding ? binding.network.url() : "";
InspectorTest.addResult(" " + uiSourceCode.url() + " -> " + url);
}
}
InspectorTest.runTestSuite([
- function testAutomaticMapping(next)
- {
- InspectorTest.addResult("Adding file system.");
- var fs = new InspectorTest.TestFileSystem("file:///var/www");
- fs.root.mkdir("html").addFile("foo.js", "<foo content>");
- fs.root.addFile("bar.js", "<bar content>");
- fs.reportCreated(fileSystemCreated1);
- var networkUISourceCode;
-
- function fileSystemCreated1()
- {
- InspectorTest.addResult("Adding network resource.");
- InspectorTest.waitForUISourceCode(scriptsAdded, "resources/bar.js");
- InspectorTest.evaluateInPage("addScript('resources/html/foo.js')");
- InspectorTest.evaluateInPage("addScript('resources/bar.js')");
- }
-
- function scriptsAdded()
- {
- dumpFileSystemUISourceCodesMappings();
-
- var uiSourceCode = Workspace.workspace.uiSourceCode(fileSystemProjectId, "file:///var/www/html/foo.js");
- networkUISourceCode = Workspace.workspace.uiSourceCode(Bindings.NetworkProject.projectId(target, InspectorTest.resourceTreeModel.mainFrame, false), "http://127.0.0.1:8000/inspector/resources/html/foo.js");
- InspectorTest.addResult("Adding mapping between network and file system resources.");
-
- var fileSystemPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(uiSourceCode.project().id());
- Workspace.fileSystemMapping.addMappingForResource(networkUISourceCode.url(), fileSystemPath, uiSourceCode.url());
- var setting = JSON.stringify(Workspace.fileSystemMapping._fileSystemMappingSetting.get());
-
- InspectorTest.addResult("Emulate reloading inspector.");
- fs.reportRemoved();
- Workspace.fileSystemMapping._fileSystemMappingSetting.set(JSON.parse(setting));
- Workspace.fileSystemMapping._loadFromSettings();
- fs.reportCreated(fileSystemCreated2);
- }
-
- function fileSystemCreated2()
- {
- dumpFileSystemUISourceCodesMappings();
-
- InspectorTest.addResult("Removing mapping between network and file system resources.");
- var uiSourceCode = Workspace.workspace.uiSourceCode(fileSystemProjectId, "file:///var/www/html/foo.js");
- Workspace.fileSystemMapping.removeMappingForURL(uiSourceCode.url());
-
- InspectorTest.addResult("Emulate reloading inspector.");
- fs.reportRemoved();
- fs.reportCreated(fileSystemCreated3);
- }
-
- function fileSystemCreated3()
- {
- dumpFileSystemUISourceCodesMappings();
-
- Workspace.fileSystemMapping.removeMappingForURL(networkUISourceCode.url());
- fs.reportRemoved();
- next();
- }
- },
-
function testProjectBasedMapping(next)
{
InspectorTest.addResult("Adding file system.");
var fs = new InspectorTest.TestFileSystem("file:///var/www");
- fs.root.mkdir("html").addFile("foo.js", "<foo content>");
- fs.root.mkdir("html2").addFile("bar.js", "<bar content>");
+ fs.root.mkdir("html").addFile("foo.js", "var foo = 1;");
+ fs.root.mkdir("html2").addFile("bar.js", "var bar = 2;");
fs.root.addFile(".devtools", JSON.stringify({ mappings: [ { folder: "/html/", url: "http://127.0.0.1:8000/inspector/resources/html/" }, { folder: "/html2/", url: "http://127.0.0.1:8000/inspector/resources/html2/" } ]}));
fs.reportCreated(fileSystemCreated);
@@ -101,10 +42,13 @@ function test()
{
InspectorTest.evaluateInPage("addScript('resources/html/foo.js')");
InspectorTest.evaluateInPage("addScript('resources/html2/bar.js')");
- InspectorTest.waitForUISourceCode(scriptsAdded, "resources/html2/bar.js");
+ Promise.all([
+ InspectorTest.waitForBinding("foo.js"),
+ InspectorTest.waitForBinding("bar.js")
+ ]).then(onBindings);
}
- function scriptsAdded()
+ function onBindings()
{
dumpFileSystemUISourceCodesMappings();
fs.reportRemoved();
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/file-system-project-mapping-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698