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

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

Issue 2110543008: Move UndoStack from Page to Editor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use |const Member| and add notes to UndoStack class 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 <script src="../editing.js"></script> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
2 4
3 <script> 5 <script>
4 function log(message) { 6 function part1() {
5 var console = document.getElementById("console"); 7 add_result_callback(function(result) {
6 var li = document.createElement("li"); 8 if (result.status == result.PASS)
7 var text = document.createTextNode(message); 9 window.location = window.location.toString() + '?part2';
8 li.appendChild(text); 10 });
9 console.appendChild(li);
10 }
11 11
12 function part1() { 12 test(function() {
13 frames['iframe'].document.body.focus(); 13 frames['iframe'].document.body.focus();
14 14 frames['iframe'].document.execCommand('InsertText', false, 'c');
15 // Hack to perform the editing command. Should be able to
16 // call execCommand on the main document.
17 frames['iframe'].document.execCommand('InsertText', false, 'c');
18 15
19 if (frames['iframe'].document.body.innerText != 'c') { 16 assert_equals(frames['iframe'].document.body.innerText, 'c',
20 log("FAIL: could not insert text."); 17 'Text should be inserted into the subframe.');
21 if (window.testRunner)
22 testRunner.notifyDone();
23 return;
24 }
25 18
26 if (!document.queryCommandEnabled('Undo')) { 19 assert_false(document.queryCommandEnabled('Undo'),
27 log("FAIL: Undo is not enabled after text insertion."); 20 'Undo should not be enabled in main document by text insert ion in subframe.');
28 if (window.testRunner) 21 }, 'Checks with modification in the subframe.');
29 testRunner.notifyDone();
30 return;
31 }
32
33 window.location = window.location.toString() + "?part2";
34 } 22 }
35 23
36 function part2() { 24 function part2() {
37 if (frames['iframe'].document.body.innerText != '') 25 test(function() {
38 log("FAIL: subframe still has old content after navigaiton."); 26 assert_equals(frames['iframe'].document.body.innerText, '',
27 'Subframe should not have old content after navigaiton.');
39 28
40 if (!document.queryCommandEnabled('Undo')) 29 assert_false(document.queryCommandEnabled('Undo'),
41 log("Success"); 30 'Undo should not be enabled after the location changed.');
42 else 31 }, 'Checks after the subframe has navigated');
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();
47 } 32 }
48 33
49 function runTest() { 34 function runTest() {
50 if (window.location.toString().indexOf("?part2") == -1) { 35 if (window.location.toString().indexOf("?part2") == -1) {
51 part1(); 36 part1();
52 } else { 37 } else {
53 part2(); 38 part2();
54 } 39 }
55 } 40 }
56
57 if (window.testRunner) {
58 testRunner.waitUntilDone();
59 testRunner.dumpAsText();
60 }
61
62 </script> 41 </script>
63 42
64 <body onload="runTest()"> 43 <body onload="runTest()">
65 <iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></ifram e> 44 <iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></ifram e>
66 <ul id="console"></ul> 45 <div id="log"></div>
67 </body> 46 </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