summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 20:41:59 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 20:41:59 +0000
commit111fa63e08ee1dc70aafd7289f4d81cdf36ef959 (patch)
tree558b876f503ad396688447af33de6d96429fde3c
parentc850c202013c1e237581e49404d6bc29a7726ac6 (diff)
downloadchromium_src-111fa63e08ee1dc70aafd7289f4d81cdf36ef959.zip
chromium_src-111fa63e08ee1dc70aafd7289f4d81cdf36ef959.tar.gz
chromium_src-111fa63e08ee1dc70aafd7289f4d81cdf36ef959.tar.bz2
Fix layout test controller simulation script to make it work for worker UI test.
BUG=none TEST=none Review URL: http://codereview.chromium.org/160670 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22527 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/data/layout_tests/layout_test_controller.html18
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/test/data/layout_tests/layout_test_controller.html b/chrome/test/data/layout_tests/layout_test_controller.html
index 5e14a39..ff9f776 100644
--- a/chrome/test/data/layout_tests/layout_test_controller.html
+++ b/chrome/test/data/layout_tests/layout_test_controller.html
@@ -1,7 +1,10 @@
<script>
function LayoutTestController() {
+ this.dump_as_text_ = false;
this.wait_until_done_ = false;
- this.dumpAsText = function () { };
+ this.dumpAsText = function () {
+ this.dump_as_text_ = true;
+ };
this.waitUntilDone = function () {
this.wait_until_done_ = true;
};
@@ -9,12 +12,21 @@ function LayoutTestController() {
var cookie = "%COOKIE%=" + encodeURIComponent(document.firstChild.innerText);
document.cookie = cookie;
};
- this.OnTimerEvent = function () {
+ this.OnCheckFinishEvent = function () {
// Some layout tests do not call waitUntilDone. If this is true, we should
// assume the test is done when it's finished loading.
- if (!this.wait_until_done_)
+ if (!layoutTestController.wait_until_done_)
layoutTestController.notifyDone();
};
+ this.OnTimerEvent = function () {
+ // Some layout tests put the script in the body part which causes it to be
+ // executed after onload being triggered. To handle this, we check first if
+ // dumpAsText() is called.
+ if (layoutTestController.dump_as_text_)
+ layoutTestController.OnCheckFinishEvent();
+ else
+ setTimeout(layoutTestController.OnTimerEvent, 200);
+ };
this.OnLoadEvent = function (event) {
// Do a timeout to ensure that we run after all other onload handlers have
// finished.