OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/chrome_switches.h" | 5 #include "chrome/common/chrome_switches.h" |
6 #include "chrome/test/automation/tab_proxy.h" | 6 #include "chrome/test/automation/tab_proxy.h" |
7 #include "chrome/test/ui/ui_test.h" | 7 #include "chrome/test/ui/ui_test.h" |
8 | 8 |
9 const char kTestCompleteCookie[] = "status"; | 9 const char kTestCompleteCookie[] = "status"; |
10 const char kTestCompleteSuccess[] = "OK"; | 10 const char kTestCompleteSuccess[] = "OK"; |
11 const int kTestIntervalMs = 250; | 11 const int kTestIntervalMs = 250; |
12 const int kTestWaitTimeoutMs = 30 * 1000; | 12 const int kTestWaitTimeoutMs = 30 * 1000; |
13 | 13 |
14 class WorkerTest : public UITest { | 14 class WorkerTest : public UITest { |
15 protected: | 15 protected: |
16 WorkerTest() : UITest() { | 16 WorkerTest() : UITest() { |
17 launch_arguments_.AppendSwitch(switches::kEnableWebWorkers); | 17 launch_arguments_.AppendSwitch(switches::kEnableWebWorkers); |
18 } | 18 } |
19 | 19 |
20 void RunTest(const std::wstring& test_case) { | 20 void RunTest(const std::wstring& test_case) { |
21 scoped_ptr<TabProxy> tab(GetActiveTab()); | 21 scoped_refptr<TabProxy> tab(GetActiveTab()); |
22 | 22 |
23 GURL url = GetTestUrl(L"workers", test_case); | 23 GURL url = GetTestUrl(L"workers", test_case); |
24 ASSERT_TRUE(tab->NavigateToURL(url)); | 24 ASSERT_TRUE(tab->NavigateToURL(url)); |
25 | 25 |
26 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, | 26 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, |
27 kTestCompleteCookie, kTestIntervalMs, kTestWaitTimeoutMs); | 27 kTestCompleteCookie, kTestIntervalMs, kTestWaitTimeoutMs); |
28 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); | 28 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 TEST_F(WorkerTest, SingleWorker) { | 32 TEST_F(WorkerTest, SingleWorker) { |
33 RunTest(L"single_worker.html"); | 33 RunTest(L"single_worker.html"); |
34 } | 34 } |
35 | 35 |
36 TEST_F(WorkerTest, MultipleWorkers) { | 36 TEST_F(WorkerTest, MultipleWorkers) { |
37 RunTest(L"multi_worker.html"); | 37 RunTest(L"multi_worker.html"); |
38 } | 38 } |
39 | 39 |
OLD | NEW |