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/file_path.h" | 6 #include "base/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/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/browser/worker_host/worker_process_host.h" | 17 #include "content/browser/worker_host/worker_process_host.h" |
17 #include "content/browser/worker_host/worker_service_impl.h" | 18 #include "content/browser/worker_host/worker_service_impl.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/common/content_paths.h" | 20 #include "content/public/common/content_paths.h" |
20 #include "content/test/layout_browsertest.h" | 21 #include "content/test/layout_browsertest.h" |
21 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
22 | 23 |
23 using content::BrowserThread; | 24 using content::BrowserThread; |
24 using content::WorkerServiceImpl; | 25 using content::WorkerServiceImpl; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 FilePath().AppendASCII(test_case)); | 281 FilePath().AppendASCII(test_case)); |
281 return ui_test_utils::GetFileUrlWithQuery(test_file_path, query); | 282 return ui_test_utils::GetFileUrlWithQuery(test_file_path, query); |
282 } | 283 } |
283 | 284 |
284 void RunTest(Browser* browser, | 285 void RunTest(Browser* browser, |
285 const std::string& test_case, | 286 const std::string& test_case, |
286 const std::string& query) { | 287 const std::string& query) { |
287 GURL url = GetTestURL(test_case, query); | 288 GURL url = GetTestURL(test_case, query); |
288 const string16 expected_title = ASCIIToUTF16("OK"); | 289 const string16 expected_title = ASCIIToUTF16("OK"); |
289 ui_test_utils::TitleWatcher title_watcher( | 290 ui_test_utils::TitleWatcher title_watcher( |
290 browser->GetActiveWebContents(), expected_title); | 291 chrome::GetActiveWebContents(browser), expected_title); |
291 ui_test_utils::NavigateToURL(browser, url); | 292 ui_test_utils::NavigateToURL(browser, url); |
292 string16 final_title = title_watcher.WaitAndGetTitle(); | 293 string16 final_title = title_watcher.WaitAndGetTitle(); |
293 EXPECT_EQ(expected_title, final_title); | 294 EXPECT_EQ(expected_title, final_title); |
294 } | 295 } |
295 | 296 |
296 void RunTest(const std::string& test_case, const std::string& query) { | 297 void RunTest(const std::string& test_case, const std::string& query) { |
297 RunTest(browser(), test_case, query); | 298 RunTest(browser(), test_case, query); |
298 } | 299 } |
299 | 300 |
300 static void CountWorkerProcesses(int *cur_process_count) { | 301 static void CountWorkerProcesses(int *cur_process_count) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // the same worker that was queued in the first window, to ensure it gets | 488 // the same worker that was queued in the first window, to ensure it gets |
488 // connected to the first window too. | 489 // connected to the first window too. |
489 query = StringPrintf("?id=%d", max_workers_per_tab); | 490 query = StringPrintf("?id=%d", max_workers_per_tab); |
490 url = GetTestURL("single_shared_worker.html", query); | 491 url = GetTestURL("single_shared_worker.html", query); |
491 ui_test_utils::NavigateToURLWithDisposition( | 492 ui_test_utils::NavigateToURLWithDisposition( |
492 browser(), url, NEW_FOREGROUND_TAB, | 493 browser(), url, NEW_FOREGROUND_TAB, |
493 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 494 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
494 | 495 |
495 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1)); | 496 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1)); |
496 } | 497 } |
OLD | NEW |