diff options
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"); +} + |