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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change.html

Issue 2127463002: Revert of Move UndoStack from Page to Editor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <script src="../editing.js"></script>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 2
5 <script> 3 <script>
4 function log(message) {
5 var console = document.getElementById("console");
6 var li = document.createElement("li");
7 var text = document.createTextNode(message);
8 li.appendChild(text);
9 console.appendChild(li);
10 }
11
6 function part1() { 12 function part1() {
7 add_result_callback(function(result) { 13 frames['iframe'].document.body.focus();
8 if (result.status == result.PASS) 14
9 window.location = window.location.toString() + '?part2'; 15 // Hack to perform the editing command. Should be able to
10 }); 16 // call execCommand on the main document.
17 frames['iframe'].document.execCommand('InsertText', false, 'c');
11 18
12 test(function() { 19 if (frames['iframe'].document.body.innerText != 'c') {
13 frames['iframe'].document.body.focus(); 20 log("FAIL: could not insert text.");
14 frames['iframe'].document.execCommand('InsertText', false, 'c'); 21 if (window.testRunner)
22 testRunner.notifyDone();
23 return;
24 }
15 25
16 assert_equals(frames['iframe'].document.body.innerText, 'c', 26 if (!document.queryCommandEnabled('Undo')) {
17 'Text should be inserted into the subframe.'); 27 log("FAIL: Undo is not enabled after text insertion.");
28 if (window.testRunner)
29 testRunner.notifyDone();
30 return;
31 }
18 32
19 assert_false(document.queryCommandEnabled('Undo'), 33 window.location = window.location.toString() + "?part2";
20 'Undo should not be enabled in main document by text insert ion in subframe.');
21 }, 'Checks with modification in the subframe.');
22 } 34 }
23 35
24 function part2() { 36 function part2() {
25 test(function() { 37 if (frames['iframe'].document.body.innerText != '')
26 assert_equals(frames['iframe'].document.body.innerText, '', 38 log("FAIL: subframe still has old content after navigaiton.");
27 'Subframe should not have old content after navigaiton.');
28 39
29 assert_false(document.queryCommandEnabled('Undo'), 40 if (!document.queryCommandEnabled('Undo'))
30 'Undo should not be enabled after the location changed.'); 41 log("Success");
31 }, 'Checks after the subframe has navigated'); 42 else
43 log("Failure, Undo was still enabled after the location changed (but at least we didn't crash!)");
44
45 if (window.testRunner)
46 testRunner.notifyDone();
32 } 47 }
33 48
34 function runTest() { 49 function runTest() {
35 if (window.location.toString().indexOf("?part2") == -1) { 50 if (window.location.toString().indexOf("?part2") == -1) {
36 part1(); 51 part1();
37 } else { 52 } else {
38 part2(); 53 part2();
39 } 54 }
40 } 55 }
56
57 if (window.testRunner) {
58 testRunner.waitUntilDone();
59 testRunner.dumpAsText();
60 }
61
41 </script> 62 </script>
42 63
43 <body onload="runTest()"> 64 <body onload="runTest()">
44 <iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></ifram e> 65 <iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></ifram e>
45 <div id="log"></div> 66 <ul id="console"></ul>
46 </body> 67 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698