Index: third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3620dc3f032c06b09e3d81dcb9fac0abbdb18fd |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html |
@@ -0,0 +1,70 @@ |
+<html> |
+<head> |
+<script src="../inspector-test.js"></script> |
+<script src="../debugger-test.js"></script> |
+<script src="../workspace-test.js"></script> |
+<script src="../isolated-filesystem-test.js"></script> |
+<script src="./persistence-test.js"></script> |
+<script src="./resources/foo.js"></script> |
+<script> |
+ |
+function test() |
+{ |
+ var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
+ var fsEntry = InspectorTest.addFooJSFile(fs); |
+ |
+ var networkCode, fileSystemCode; |
+ |
+ InspectorTest.runTestSuite([ |
+ function addFileSystem(next) |
+ { |
+ fs.reportCreated(next); |
+ }, |
+ |
+ function addFileMapping(next) |
+ { |
+ InspectorTest.waitForBinding("foo.js").then(onBindingCreated); |
+ WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "http://127.0.0.1:8000", "/"); |
+ |
+ function onBindingCreated(binding) |
+ { |
+ InspectorTest.addResult("Binding created: " + binding); |
+ networkCode = binding.network; |
+ fileSystemCode = binding.fileSystem; |
+ next(); |
+ } |
+ }, |
+ |
+ function changeFileSystem(next) |
+ { |
+ InspectorTest.addSniffer(WebInspector.Persistence.prototype, "_contentSyncedForTest", onSynced); |
+ fsEntry.setContent("window.foo3 = 3;"); |
+ |
+ function onSynced() |
+ { |
+ InspectorTest.addResult(`network code: '${networkCode.workingCopy()}'`); |
+ InspectorTest.addResult(`fileSystem code: '${fileSystemCode.workingCopy()}'`); |
+ next(); |
+ } |
+ }, |
+ |
+ function changeNetworkUISourceCode(next) |
+ { |
+ InspectorTest.addSniffer(WebInspector.Persistence.prototype, "_contentSyncedForTest", onSynced); |
+ networkCode.addRevision("window.foo2 = 2;"); |
+ |
+ function onSynced() |
+ { |
+ InspectorTest.addResult(`network code: '${networkCode.workingCopy()}'`); |
+ InspectorTest.addResult(`fileSystem code: '${fileSystemCode.workingCopy()}'`); |
+ next(); |
+ } |
+ } |
+ ]); |
+}; |
+</script> |
+</head> |
+<body onload="runTest()"> |
+<p>Tests that persistence syncs network and filesystem UISourceCodes.</p> |
+</body> |
+</html> |