Index: third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change.html |
diff --git a/third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change.html b/third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change.html |
index 049ac0593afb3b23a3470d5058a99bcb91d3df2f..6b7aa2c2a280a7ec6ddfa73c5aaf1b622fb18015 100644 |
--- a/third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change.html |
+++ b/third_party/WebKit/LayoutTests/editing/undo/undo-iframe-location-change.html |
@@ -1,34 +1,49 @@ |
-<!DOCTYPE html> |
-<script src="../../resources/testharness.js"></script> |
-<script src="../../resources/testharnessreport.js"></script> |
+<script src="../editing.js"></script> |
<script> |
+function log(message) { |
+ var console = document.getElementById("console"); |
+ var li = document.createElement("li"); |
+ var text = document.createTextNode(message); |
+ li.appendChild(text); |
+ console.appendChild(li); |
+} |
+ |
function part1() { |
- add_result_callback(function(result) { |
- if (result.status == result.PASS) |
- window.location = window.location.toString() + '?part2'; |
- }); |
+ frames['iframe'].document.body.focus(); |
+ |
+ // Hack to perform the editing command. Should be able to |
+ // call execCommand on the main document. |
+ frames['iframe'].document.execCommand('InsertText', false, 'c'); |
- test(function() { |
- frames['iframe'].document.body.focus(); |
- frames['iframe'].document.execCommand('InsertText', false, 'c'); |
+ if (frames['iframe'].document.body.innerText != 'c') { |
+ log("FAIL: could not insert text."); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ return; |
+ } |
- assert_equals(frames['iframe'].document.body.innerText, 'c', |
- 'Text should be inserted into the subframe.'); |
+ if (!document.queryCommandEnabled('Undo')) { |
+ log("FAIL: Undo is not enabled after text insertion."); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ return; |
+ } |
- assert_false(document.queryCommandEnabled('Undo'), |
- 'Undo should not be enabled in main document by text insertion in subframe.'); |
- }, 'Checks with modification in the subframe.'); |
+ window.location = window.location.toString() + "?part2"; |
} |
function part2() { |
- test(function() { |
- assert_equals(frames['iframe'].document.body.innerText, '', |
- 'Subframe should not have old content after navigaiton.'); |
+ if (frames['iframe'].document.body.innerText != '') |
+ log("FAIL: subframe still has old content after navigaiton."); |
- assert_false(document.queryCommandEnabled('Undo'), |
- 'Undo should not be enabled after the location changed.'); |
- }, 'Checks after the subframe has navigated'); |
+ if (!document.queryCommandEnabled('Undo')) |
+ log("Success"); |
+ else |
+ log("Failure, Undo was still enabled after the location changed (but at least we didn't crash!)"); |
+ |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
} |
function runTest() { |
@@ -38,9 +53,15 @@ |
part2(); |
} |
} |
+ |
+if (window.testRunner) { |
+ testRunner.waitUntilDone(); |
+ testRunner.dumpAsText(); |
+} |
+ |
</script> |
<body onload="runTest()"> |
<iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></iframe> |
-<div id="log"></div> |
+<ul id="console"></ul> |
</body> |