diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:45:06 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:45:06 +0000 |
commit | 73b8a1ce654d9d0f82f02c1838f803f5ec345e7f (patch) | |
tree | 0a489c3c8597dccec78f9f59677be9978c741ef9 /chrome/worker | |
parent | 9c035022e847ba18bb51f63212f9cb86c9cf27c0 (diff) | |
download | chromium_src-73b8a1ce654d9d0f82f02c1838f803f5ec345e7f.zip chromium_src-73b8a1ce654d9d0f82f02c1838f803f5ec345e7f.tar.gz chromium_src-73b8a1ce654d9d0f82f02c1838f803f5ec345e7f.tar.bz2 |
We need to add UI tests to test workers after we switch to process-per-worker model and remove uses of V8 lockers. Due to this, we can not run any worker layout test that starts multiple workers because we load V8 instance in DLL in test shell. To cover this deficiency, we need to add UI tests to test multiple workers.
BUG=12554
TEST=none
Review URL: http://codereview.chromium.org/115731
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/worker')
-rw-r--r-- | chrome/worker/worker_uitest.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc new file mode 100644 index 0000000..6297cb3 --- /dev/null +++ b/chrome/worker/worker_uitest.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/chrome_switches.h" +#include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/ui/ui_test.h" + +const char kTestCompleteCookie[] = "status"; +const char kTestCompleteSuccess[] = "OK"; +const int kTestIntervalMs = 250; +const int kTestWaitTimeoutMs = 10 * 1000; + +class WorkerTest : public UITest { + protected: + WorkerTest() : UITest() { + launch_arguments_.AppendSwitch(switches::kEnableWebWorkers); + } + + void RunTest(const std::wstring& test_case) { + scoped_ptr<TabProxy> tab(GetActiveTab()); + + GURL url = GetTestUrl(L"workers", test_case); + ASSERT_TRUE(tab->NavigateToURL(url)); + + std::string value = WaitUntilCookieNonEmpty(tab.get(), url, + kTestCompleteCookie, kTestIntervalMs, kTestWaitTimeoutMs); + ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); + } +}; + +TEST_F(WorkerTest, SingleWorker) { + RunTest(L"single_worker.html"); +} + +TEST_F(WorkerTest, MultipleWorkers) { + RunTest(L"multi_worker.html"); +} + |