summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 22:16:04 +0000
committerpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 22:16:04 +0000
commit0b8ce483ee86d5ad606548e18dbc97976871bf8d (patch)
treeecc8ac5577377a0e90e1f084140080e16de4380b
parent8fd6ced8d82d80fc46894dae13d2e51e552b9e2b (diff)
downloadchromium_src-0b8ce483ee86d5ad606548e18dbc97976871bf8d.zip
chromium_src-0b8ce483ee86d5ad606548e18dbc97976871bf8d.tar.gz
chromium_src-0b8ce483ee86d5ad606548e18dbc97976871bf8d.tar.bz2
Make wrapper-context.html faster by eliminating timeouts.
BUG=4391 TEST=covered by layout tests Review URL: http://codereview.chromium.org/42097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11584 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/data/layout_tests/chrome/fast/dom/resources/wrapper-context-inner.html20
-rw-r--r--webkit/data/layout_tests/chrome/fast/dom/wrapper-context-expected.txt5
-rw-r--r--webkit/data/layout_tests/chrome/fast/dom/wrapper-context.html32
3 files changed, 28 insertions, 29 deletions
diff --git a/webkit/data/layout_tests/chrome/fast/dom/resources/wrapper-context-inner.html b/webkit/data/layout_tests/chrome/fast/dom/resources/wrapper-context-inner.html
index c47aa6e..7c9a315 100644
--- a/webkit/data/layout_tests/chrome/fast/dom/resources/wrapper-context-inner.html
+++ b/webkit/data/layout_tests/chrome/fast/dom/resources/wrapper-context-inner.html
@@ -1,27 +1,23 @@
<html>
-<body onload="RunTest()">
+<body onload="notifyLoaded()">
<script>
-// Used from the top frame to know when this frame has been loaded.
-var loaded = false;
+function notifyLoaded() {
+ top.innerHasLoaded();
+}
// After the top frame has accessed the document of this frame, we
// test that the document wrapper was created in this context and
// not in the top context.
-function RunTest() {
- loaded = true;
- if (top.innerDocument) {
+function runTest() {
var paragraph = document.createElement('p');
if (HTMLElement.prototype.isPrototypeOf(paragraph)) {
- top.WriteOutput("PASS");
+ top.writeOutput("PASS");
} else {
- top.WriteOutput("FAIL");
+ top.writeOutput("FAIL");
}
if (window.layoutTestController) {
- layoutTestController.notifyDone();
+ layoutTestController.notifyDone();
}
- } else {
- setTimeout(RunTest, 100);
- }
}
</script>
</body>
diff --git a/webkit/data/layout_tests/chrome/fast/dom/wrapper-context-expected.txt b/webkit/data/layout_tests/chrome/fast/dom/wrapper-context-expected.txt
index 7ef22e9..7723cae 100644
--- a/webkit/data/layout_tests/chrome/fast/dom/wrapper-context-expected.txt
+++ b/webkit/data/layout_tests/chrome/fast/dom/wrapper-context-expected.txt
@@ -1 +1,6 @@
+Tests that node wrappers are created in the context to which they belong. You should see PASS below.
+Running...
+
PASS
+
+
diff --git a/webkit/data/layout_tests/chrome/fast/dom/wrapper-context.html b/webkit/data/layout_tests/chrome/fast/dom/wrapper-context.html
index 3f038d8..31b39ad 100644
--- a/webkit/data/layout_tests/chrome/fast/dom/wrapper-context.html
+++ b/webkit/data/layout_tests/chrome/fast/dom/wrapper-context.html
@@ -1,32 +1,30 @@
<html>
-<body onload="AccessInnerDocument()">
+<body>
+Tests that node wrappers are created in the context to which they belong.
+You should see PASS below.
+<br>
<div id="output"></div>
<iframe id="inner" src="resources/wrapper-context-inner.html"></iframe>
<script>
if (window.layoutTestController) {
- layoutTestController.waitUntilDone();
- layoutTestController.dumpAsText();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
}
-// Write to the output div.
-function WriteOutput(s) {
- var paragraph = document.createElement("p");
- paragraph.innerHTML = s;
- document.getElementById("output").appendChild(paragraph);
+function writeOutput(s) {
+ var paragraph = document.createElement("p");
+ paragraph.innerHTML = s;
+ document.getElementById("output").appendChild(paragraph);
}
-// Used from the inner frame to know when this frame has accessed
-// the document of the inner frame.
+// Used to create the document wrapper.
var innerDocument;
-// Once the inner frame has loaded, access it's document and assign
-// the wrapper to innerDocument.
-function AccessInnerDocument() {
- if (inner.loaded) {
+// Once the inner frame has loaded, run the test.
+function innerHasLoaded() {
+ writeOutput("Running...");
innerDocument = inner.document;
- } else {
- setTimeout(AccessInnerDocument, 100);
- }
+ inner.runTest();
}
</script>
</body>