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 6b7aa2c2a280a7ec6ddfa73c5aaf1b622fb18015..049ac0593afb3b23a3470d5058a99bcb91d3df2f 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,49 +1,34 @@ |
-<script src="../editing.js"></script> |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.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() { |
- 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'); |
+ add_result_callback(function(result) { |
+ if (result.status == result.PASS) |
+ window.location = window.location.toString() + '?part2'; |
+ }); |
- if (frames['iframe'].document.body.innerText != 'c') { |
- log("FAIL: could not insert text."); |
- if (window.testRunner) |
- testRunner.notifyDone(); |
- return; |
- } |
+ test(function() { |
+ frames['iframe'].document.body.focus(); |
+ frames['iframe'].document.execCommand('InsertText', false, 'c'); |
- if (!document.queryCommandEnabled('Undo')) { |
- log("FAIL: Undo is not enabled after text insertion."); |
- if (window.testRunner) |
- testRunner.notifyDone(); |
- return; |
- } |
+ assert_equals(frames['iframe'].document.body.innerText, 'c', |
+ 'Text should be inserted into the subframe.'); |
- window.location = window.location.toString() + "?part2"; |
+ assert_false(document.queryCommandEnabled('Undo'), |
+ 'Undo should not be enabled in main document by text insertion in subframe.'); |
+ }, 'Checks with modification in the subframe.'); |
} |
function part2() { |
- if (frames['iframe'].document.body.innerText != '') |
- log("FAIL: subframe still has old content after navigaiton."); |
+ test(function() { |
+ assert_equals(frames['iframe'].document.body.innerText, '', |
+ 'Subframe should not have old content after navigaiton.'); |
- 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(); |
+ assert_false(document.queryCommandEnabled('Undo'), |
+ 'Undo should not be enabled after the location changed.'); |
+ }, 'Checks after the subframe has navigated'); |
} |
function runTest() { |
@@ -53,15 +38,9 @@ function runTest() { |
part2(); |
} |
} |
- |
-if (window.testRunner) { |
- testRunner.waitUntilDone(); |
- testRunner.dumpAsText(); |
-} |
- |
</script> |
<body onload="runTest()"> |
<iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></iframe> |
-<ul id="console"></ul> |
+<div id="log"></div> |
</body> |