OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 GURL GetTestURL(const std::string& test_case, const std::string& query) { | 35 GURL GetTestURL(const std::string& test_case, const std::string& query) { |
36 base::FilePath test_file_path = GetTestFilePath( | 36 base::FilePath test_file_path = GetTestFilePath( |
37 "workers", test_case.c_str()); | 37 "workers", test_case.c_str()); |
38 return GetFileUrlWithQuery(test_file_path, query); | 38 return GetFileUrlWithQuery(test_file_path, query); |
39 } | 39 } |
40 | 40 |
41 void RunTest(Shell* window, | 41 void RunTest(Shell* window, |
42 const std::string& test_case, | 42 const std::string& test_case, |
43 const std::string& query) { | 43 const std::string& query) { |
44 GURL url = GetTestURL(test_case, query); | 44 GURL url = GetTestURL(test_case, query); |
45 const string16 expected_title = ASCIIToUTF16("OK"); | 45 const base::string16 expected_title = ASCIIToUTF16("OK"); |
46 TitleWatcher title_watcher(window->web_contents(), expected_title); | 46 TitleWatcher title_watcher(window->web_contents(), expected_title); |
47 NavigateToURL(window, url); | 47 NavigateToURL(window, url); |
48 string16 final_title = title_watcher.WaitAndGetTitle(); | 48 base::string16 final_title = title_watcher.WaitAndGetTitle(); |
49 EXPECT_EQ(expected_title, final_title); | 49 EXPECT_EQ(expected_title, final_title); |
50 } | 50 } |
51 | 51 |
52 void RunTest(const std::string& test_case, const std::string& query) { | 52 void RunTest(const std::string& test_case, const std::string& query) { |
53 RunTest(shell(), test_case, query); | 53 RunTest(shell(), test_case, query); |
54 } | 54 } |
55 | 55 |
56 static void CountWorkerProcesses(int *cur_process_count) { | 56 static void CountWorkerProcesses(int *cur_process_count) { |
57 *cur_process_count = 0; | 57 *cur_process_count = 0; |
58 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) | 58 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 // Generate test URL. | 269 // Generate test URL. |
270 std::string scheme("http"); | 270 std::string scheme("http"); |
271 GURL::Replacements replacements; | 271 GURL::Replacements replacements; |
272 replacements.SetSchemeStr(scheme); | 272 replacements.SetSchemeStr(scheme); |
273 GURL url = ws_server.GetURL( | 273 GURL url = ws_server.GetURL( |
274 "websocket_shared_worker.html").ReplaceComponents(replacements); | 274 "websocket_shared_worker.html").ReplaceComponents(replacements); |
275 | 275 |
276 // Run test. | 276 // Run test. |
277 Shell* window = shell(); | 277 Shell* window = shell(); |
278 const string16 expected_title = ASCIIToUTF16("OK"); | 278 const base::string16 expected_title = ASCIIToUTF16("OK"); |
279 TitleWatcher title_watcher(window->web_contents(), expected_title); | 279 TitleWatcher title_watcher(window->web_contents(), expected_title); |
280 NavigateToURL(window, url); | 280 NavigateToURL(window, url); |
281 string16 final_title = title_watcher.WaitAndGetTitle(); | 281 base::string16 final_title = title_watcher.WaitAndGetTitle(); |
282 EXPECT_EQ(expected_title, final_title); | 282 EXPECT_EQ(expected_title, final_title); |
283 } | 283 } |
284 | 284 |
285 IN_PROC_BROWSER_TEST_F(WorkerTest, PassMessagePortToSharedWorker) { | 285 IN_PROC_BROWSER_TEST_F(WorkerTest, PassMessagePortToSharedWorker) { |
286 RunTest("pass_messageport_to_sharedworker.html", ""); | 286 RunTest("pass_messageport_to_sharedworker.html", ""); |
287 } | 287 } |
288 | 288 |
289 IN_PROC_BROWSER_TEST_F(WorkerTest, | 289 IN_PROC_BROWSER_TEST_F(WorkerTest, |
290 PassMessagePortToSharedWorkerDontWaitForConnect) { | 290 PassMessagePortToSharedWorkerDontWaitForConnect) { |
291 RunTest("pass_messageport_to_sharedworker_dont_wait_for_connect.html", ""); | 291 RunTest("pass_messageport_to_sharedworker_dont_wait_for_connect.html", ""); |
292 } | 292 } |
293 | 293 |
294 } // namespace content | 294 } // namespace content |
OLD | NEW |