summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-08 12:18:00 +0100
committerKristian Monsen <kristianm@google.com>2010-09-11 12:08:58 +0100
commit5ddde30071f639962dd557c453f2ad01f8f0fd00 (patch)
tree775803c4ab35af50aa5f5472cd1fb95fe9d5152d /LayoutTests/fast
parent3e63d9b33b753ca86d0765d1b3d711114ba9e34f (diff)
downloadexternal_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.zip
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.gz
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.bz2
Merge WebKit at r66666 : Initial merge by git.
Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f
Diffstat (limited to 'LayoutTests/fast')
-rw-r--r--LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt13
-rw-r--r--LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html13
-rw-r--r--LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js17
-rw-r--r--LayoutTests/fast/js/resources/js-test-post.js10
-rw-r--r--LayoutTests/fast/js/resources/js-test-pre.js13
-rw-r--r--LayoutTests/fast/url/resources/utilities.js16
6 files changed, 71 insertions, 11 deletions
diff --git a/LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt
new file mode 100644
index 0000000..1a77f93
--- /dev/null
+++ b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt
@@ -0,0 +1,13 @@
+Test that collapseToStart() and collapseToEnd() throw INVALID_STATE_ERR if no selection is made.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS sel.collapseToStart() threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
+PASS sel.collapseToEnd() threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
+PASS sel.collapseToStart() is undefined
+PASS sel.collapseToEnd() is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html
new file mode 100644
index 0000000..5463fff
--- /dev/null
+++ b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/collapseToX-empty-selection.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js b/LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js
new file mode 100644
index 0000000..c1fd73c
--- /dev/null
+++ b/LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js
@@ -0,0 +1,17 @@
+description("Test that collapseToStart() and collapseToEnd() throw INVALID_STATE_ERR if no selection is made.");
+
+var sel = window.getSelection();
+var textNode = document.createTextNode("abcdef");
+document.body.appendChild(textNode);
+
+shouldThrow("sel.collapseToStart()", "'Error: INVALID_STATE_ERR: DOM Exception 11'");
+shouldThrow("sel.collapseToEnd()", "'Error: INVALID_STATE_ERR: DOM Exception 11'");
+
+sel.selectAllChildren(textNode);
+
+shouldBe("sel.collapseToStart()", "undefined");
+shouldBe("sel.collapseToEnd()", "undefined");
+
+document.body.removeChild(textNode);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/resources/js-test-post.js b/LayoutTests/fast/js/resources/js-test-post.js
index 88882c5..11a9e5f 100644
--- a/LayoutTests/fast/js/resources/js-test-post.js
+++ b/LayoutTests/fast/js/resources/js-test-post.js
@@ -1,13 +1,9 @@
-function finishJSTest()
-{
- shouldBeTrue("successfullyParsed");
- debug('<br /><span class="pass">TEST COMPLETE</span>');
- if (window.jsTestIsAsync && window.layoutTestController)
- layoutTestController.notifyDone();
-}
+wasPostTestScriptParsed = true;
if (window.jsTestIsAsync) {
if (window.layoutTestController)
layoutTestController.waitUntilDone();
+ if (window.wasFinishJSTestCalled)
+ finishJSTest();
} else
finishJSTest();
diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js
index aaab749..87db5d4 100644
--- a/LayoutTests/fast/js/resources/js-test-pre.js
+++ b/LayoutTests/fast/js/resources/js-test-pre.js
@@ -280,3 +280,16 @@ function gc() {
gcRec(10)
}
}
+
+// It's possible for an async test to call finishJSTest() before js-test-post.js
+// has been parsed.
+function finishJSTest()
+{
+ wasFinishJSTestCalled = true;
+ if (!window.wasPostTestScriptParsed)
+ return;
+ shouldBeTrue("successfullyParsed");
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ if (window.jsTestIsAsync && window.layoutTestController)
+ layoutTestController.notifyDone();
+}
diff --git a/LayoutTests/fast/url/resources/utilities.js b/LayoutTests/fast/url/resources/utilities.js
index 6392198..631bdec 100644
--- a/LayoutTests/fast/url/resources/utilities.js
+++ b/LayoutTests/fast/url/resources/utilities.js
@@ -12,10 +12,18 @@ function canonicalize(url)
function setBaseURL(url)
{
- // According to the HTML5 spec, we're only supposed to honor <base> elements
- // in the <head>, but we use document.write() here to make the test run in
- // Firefox.
- document.write('<base href="' + url + '">');
+ // It would be more elegant to use the DOM here, but we chose document.write()
+ // so the tests ran correctly in Firefox at the time we originally wrote them.
+
+ // Remove any existing base elements.
+ var existingBase = document.getElementsByTagName('base');
+ while (existingBase.length) {
+ var element = existingBase[0];
+ element.parentNode.removeChild(element);
+ }
+
+ // Add a new base element.
+ document.write('<base href="' + url + '">');
}
function segments(url)