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

Unified Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger/live-edit-original-content.html

Issue 2695123004: DevTools: Only provide static script content to UISourceCode (Closed)
Patch Set: Now there is less Created 3 years, 10 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/inspector/sources/debugger/live-edit-original-content.html
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger/live-edit-original-content.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger/live-edit-original-content.html
new file mode 100644
index 0000000000000000000000000000000000000000..aaa1fce304b5522b309c1b763905ffd715a7a0f3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger/live-edit-original-content.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../../http/tests/inspector/debugger-test.js"></script>
+<script src="../../../http/tests/inspector/live-edit-test.js"></script>
+<script src="resources/edit-me.js"></script>
+
+<script>
+
+function test() {
+ InspectorTest.startDebuggerTest(testStarted);
+ function testStarted() {
+ InspectorTest.showScriptSource("edit-me.js", didShowScriptSource);
+ }
+
+ function didShowScriptSource(sourceFrame) {
+ replaceInSource(sourceFrame, "return 0;", "return \"live-edited string\";", didEditScriptSource);
+ }
+
+ function didEditScriptSource() {
+ UI.panels.sources.sourcesView().currentUISourceCode().requestOriginalContent().then(gotOriginalContent)
+ }
+
+ function gotOriginalContent(originalContent) {
+ InspectorTest.addResult('==== Original Content ====');
+ InspectorTest.addResult(originalContent);
+ UI.panels.sources.sourcesView().currentUISourceCode().requestContent().then(gotContent)
+ }
+
+ function gotContent(content) {
+ InspectorTest.addResult('');
+ InspectorTest.addResult('');
+ InspectorTest.addResult('==== Current Content ====');
+ InspectorTest.addResult(content);
+ InspectorTest.completeDebuggerTest();
+ }
+
+ function replaceInSource(sourceFrame, string, replacement, callback) {
+ InspectorTest.addSniffer(InspectorTest.debuggerModel, "_didEditScriptSource", callback);
+ InspectorTest.replaceInSource(sourceFrame, string, replacement);
+ InspectorTest.commitSource(sourceFrame);
+ }
+}
+
+</script>
+
+</head>
+
+<body onload="runTest()">
+<p>Tests that the original content is accessible on live edited scripts.</p>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698