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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
8 #include "chrome/browser/worker_host/worker_service.h" | 8 #include "chrome/browser/worker_host/worker_service.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "chrome/test/automation/browser_proxy.h" | 11 #include "chrome/test/automation/browser_proxy.h" |
12 #include "chrome/test/automation/tab_proxy.h" | 12 #include "chrome/test/automation/tab_proxy.h" |
13 #include "chrome/test/ui/ui_layout_test.h" | 13 #include "chrome/test/ui/ui_layout_test.h" |
14 #include "chrome/test/ui_test_utils.h" | 14 #include "chrome/test/ui_test_utils.h" |
15 #include "net/url_request/url_request_unittest.h" | 15 #include "net/test/test_server.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kTestCompleteCookie[] = "status"; | 19 const char kTestCompleteCookie[] = "status"; |
20 const char kTestCompleteSuccess[] = "OK"; | 20 const char kTestCompleteSuccess[] = "OK"; |
21 const FilePath::CharType* kTestDir = | 21 const FilePath::CharType* kTestDir = |
22 FILE_PATH_LITERAL("workers"); | 22 FILE_PATH_LITERAL("workers"); |
23 const FilePath::CharType* kManySharedWorkersFile = | 23 const FilePath::CharType* kManySharedWorkersFile = |
24 FILE_PATH_LITERAL("many_shared_workers.html"); | 24 FILE_PATH_LITERAL("many_shared_workers.html"); |
25 const FilePath::CharType* kManyWorkersFile = | 25 const FilePath::CharType* kManyWorkersFile = |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 const wchar_t kDocRoot[] = L"chrome/test/data/workers"; | 192 const wchar_t kDocRoot[] = L"chrome/test/data/workers"; |
193 | 193 |
194 #if defined(OS_WIN) | 194 #if defined(OS_WIN) |
195 // http://crbug.com/33344 - NavigateAndWaitForAuth times out on the Windows | 195 // http://crbug.com/33344 - NavigateAndWaitForAuth times out on the Windows |
196 // build bots. | 196 // build bots. |
197 #define WorkerHttpAuth DISABLED_WorkerHttpAuth | 197 #define WorkerHttpAuth DISABLED_WorkerHttpAuth |
198 #endif | 198 #endif |
199 // Make sure that auth dialog is displayed from worker context. | 199 // Make sure that auth dialog is displayed from worker context. |
200 TEST_F(WorkerTest, WorkerHttpAuth) { | 200 TEST_F(WorkerTest, WorkerHttpAuth) { |
201 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); | 201 scoped_refptr<net::HTTPTestServer> server( |
| 202 net::HTTPTestServer::CreateServer(kDocRoot)); |
202 ASSERT_TRUE(NULL != server.get()); | 203 ASSERT_TRUE(NULL != server.get()); |
203 | 204 |
204 scoped_refptr<TabProxy> tab(GetActiveTab()); | 205 scoped_refptr<TabProxy> tab(GetActiveTab()); |
205 ASSERT_TRUE(tab.get()); | 206 ASSERT_TRUE(tab.get()); |
206 | 207 |
207 GURL url = server->TestServerPage("files/worker_auth.html"); | 208 GURL url = server->TestServerPage("files/worker_auth.html"); |
208 EXPECT_TRUE(NavigateAndWaitForAuth(tab, url)); | 209 EXPECT_TRUE(NavigateAndWaitForAuth(tab, url)); |
209 } | 210 } |
210 | 211 |
211 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
212 // http://crbug.com/33344 - NavigateAndWaitForAuth times out on the Windows | 213 // http://crbug.com/33344 - NavigateAndWaitForAuth times out on the Windows |
213 // build bots. | 214 // build bots. |
214 #define SharedWorkerHttpAuth DISABLED_SharedWorkerHttpAuth | 215 #define SharedWorkerHttpAuth DISABLED_SharedWorkerHttpAuth |
215 #endif | 216 #endif |
216 // Make sure that auth dialog is displayed from shared worker context. | 217 // Make sure that auth dialog is displayed from shared worker context. |
217 TEST_F(WorkerTest, SharedWorkerHttpAuth) { | 218 TEST_F(WorkerTest, SharedWorkerHttpAuth) { |
218 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); | 219 scoped_refptr<net::HTTPTestServer> server( |
| 220 net::HTTPTestServer::CreateServer(kDocRoot)); |
219 ASSERT_TRUE(NULL != server.get()); | 221 ASSERT_TRUE(NULL != server.get()); |
220 | 222 |
221 scoped_refptr<TabProxy> tab(GetActiveTab()); | 223 scoped_refptr<TabProxy> tab(GetActiveTab()); |
222 ASSERT_TRUE(tab.get()); | 224 ASSERT_TRUE(tab.get()); |
223 | 225 |
224 GURL url = server->TestServerPage("files/shared_worker_auth.html"); | 226 GURL url = server->TestServerPage("files/shared_worker_auth.html"); |
225 EXPECT_TRUE(NavigateAndWaitForAuth(tab, url)); | 227 EXPECT_TRUE(NavigateAndWaitForAuth(tab, url)); |
226 // TODO(atwilson): Add support to automation framework to test for auth | 228 // TODO(atwilson): Add support to automation framework to test for auth |
227 // dialogs displayed by non-navigating tabs. | 229 // dialogs displayed by non-navigating tabs. |
228 } | 230 } |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 GURL url2 = ui_test_utils::GetTestUrl(FilePath(kTestDir), | 655 GURL url2 = ui_test_utils::GetTestUrl(FilePath(kTestDir), |
654 FilePath(kSingleSharedWorkersFile)); | 656 FilePath(kSingleSharedWorkersFile)); |
655 url2 = GURL(url2.spec() + StringPrintf("?id=%d", max_workers_per_tab)); | 657 url2 = GURL(url2.spec() + StringPrintf("?id=%d", max_workers_per_tab)); |
656 ASSERT_TRUE(window->AppendTab(url2)); | 658 ASSERT_TRUE(window->AppendTab(url2)); |
657 | 659 |
658 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, | 660 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, |
659 kTestCompleteCookie, action_max_timeout_ms()); | 661 kTestCompleteCookie, action_max_timeout_ms()); |
660 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); | 662 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); |
661 ASSERT_TRUE(WaitForProcessCountToBe(2, max_workers_per_tab+1)); | 663 ASSERT_TRUE(WaitForProcessCountToBe(2, max_workers_per_tab+1)); |
662 } | 664 } |
OLD | NEW |