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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html

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
Index: third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html
new file mode 100644
index 0000000000000000000000000000000000000000..ff31efa4aa052b6ff8062fb7dbcb7e1534e651d3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html
@@ -0,0 +1,86 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../isolated-filesystem-test.js"></script>
+<script src="./persistence-test.js"></script>
+<script src="./automapping-test.js"></script>
+<script>
+
+function test()
+{
+ var timestamp = new Date("December 1, 1989");
+ var index_html = {
+ contentType: WebInspector.resourceTypes.Document,
+ content: "<body>this is main resource</body>",
+ time: timestamp
+ };
+ var foo_js = {
+ content: "console.log('foo.js!');",
+ time: null
+ };
+ var bar_css = {
+ contentType: WebInspector.resourceTypes.Stylesheet,
+ content: "* { box-sizing: border-box }",
+ time: timestamp
+ };
+ var elements_module_json = { content: "module descriptor 1" };
+ var sources_module_json = { content: "module descriptor 2" };
+ var bazContent = "alert(1);";
+
+ var automappingTest = new InspectorTest.AutomappingTest(new WebInspector.Workspace());
+ automappingTest.addNetworkResources({
+ // Make sure main resource gets mapped.
+ "http://example.com": index_html,
+
+ // Make sure simple resource gets mapped.
+ "http://example.com/path/foo.js": foo_js,
+
+ // Make sure cache busting does not prevent mapping.
+ "http://example.com/bar.css?12341234": bar_css,
+
+ // Make sure files with different timestamps DO NOT map.
+ "http://example.com/baz.js": {
+ content: bazContent,
+ time: new Date("December 3, 1989")
+ },
+
+ // Make sure files with different content lenghts DO NOT map.
+ "http://example.com/images/image.png": {
+ content: "012345",
+ time: timestamp
+ },
+
+ // Make sure assets are mapped based on path.
+ "http://example.com/elements/module.json": elements_module_json,
+ "http://example.com/sources/module.json": sources_module_json,
+ });
+
+ var fs = new InspectorTest.TestFileSystem("file:///var/www");
+ InspectorTest.addFiles(fs, {
+ "index.html": index_html,
+ "scripts/foo.js": foo_js,
+ "styles/bar.css": bar_css,
+ "scripts/baz.js": {
+ content: bazContent,
+ time: new Date("December 4, 1989")
+ },
+ "images/image.png": {
+ content: "0123456789",
+ time: timestamp
+ },
+ "modules/elements/module.json": elements_module_json,
+ "modules/sources/module.json": sources_module_json
+ });
+ fs.reportCreated(onFileSystemCreated);
+
+ function onFileSystemCreated()
+ {
+ automappingTest.waitUntilMappingIsStabilized(InspectorTest.completeTest.bind(InspectorTest));
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Verify that automapping is sane.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698