Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: content/browser/worker_host/test/worker_browsertest.cc

Issue 10820007: Move all the layout tests that ran under browser_tests to run under content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
15 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/test/base/ui_test_utils.h"
17 #include "content/browser/worker_host/worker_process_host.h" 14 #include "content/browser/worker_host/worker_process_host.h"
18 #include "content/browser/worker_host/worker_service_impl.h" 15 #include "content/browser/worker_host/worker_service_impl.h"
19 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
20 #include "content/public/common/content_paths.h" 17 #include "content/public/common/content_paths.h"
21 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
19 #include "content/public/test/test_utils.h"
20 #include "content/shell/shell.h"
21 #include "content/shell/shell_content_browser_client.h"
22 #include "content/shell/shell_resource_dispatcher_host_delegate.h"
23 #include "content/test/content_browser_test_utils.h"
22 #include "content/test/layout_browsertest.h" 24 #include "content/test/layout_browsertest.h"
23 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
24 26
25 using content::BrowserThread; 27 using content::BrowserThread;
26 using content::WorkerServiceImpl; 28 using content::WorkerServiceImpl;
27 29
28 class WorkerLayoutTest : public InProcessBrowserLayoutTest { 30 class WorkerLayoutTest : public InProcessBrowserLayoutTest {
29 public: 31 public:
30 WorkerLayoutTest() : InProcessBrowserLayoutTest( 32 WorkerLayoutTest() : InProcessBrowserLayoutTest(
31 FilePath(), FilePath().AppendASCII("fast").AppendASCII("workers")) { 33 FilePath(), FilePath().AppendASCII("fast").AppendASCII("workers")) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 FilePath websocket_test_dir; 267 FilePath websocket_test_dir;
266 ASSERT_TRUE(PathService::Get(content::DIR_LAYOUT_TESTS, &websocket_test_dir)); 268 ASSERT_TRUE(PathService::Get(content::DIR_LAYOUT_TESTS, &websocket_test_dir));
267 269
268 content::TestWebSocketServer websocket_server; 270 content::TestWebSocketServer websocket_server;
269 ASSERT_TRUE(websocket_server.Start(websocket_test_dir)); 271 ASSERT_TRUE(websocket_server.Start(websocket_test_dir));
270 272
271 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) 273 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i)
272 RunHttpLayoutTest(kLayoutTestFiles[i]); 274 RunHttpLayoutTest(kLayoutTestFiles[i]);
273 } 275 }
274 276
275 class WorkerTest : public InProcessBrowserTest { 277 class WorkerTest : public content::ContentBrowserTest {
276 public: 278 public:
277 WorkerTest() {} 279 WorkerTest() {}
278 280
279 GURL GetTestURL(const std::string& test_case, const std::string& query) { 281 GURL GetTestURL(const std::string& test_case, const std::string& query) {
280 FilePath test_file_path = ui_test_utils::GetTestFilePath( 282 FilePath test_file_path = content::GetTestFilePath(
281 FilePath(FILE_PATH_LITERAL("workers")), 283 "workers", test_case.c_str());
282 FilePath().AppendASCII(test_case)); 284 return content::GetFileUrlWithQuery(test_file_path, query);
283 return ui_test_utils::GetFileUrlWithQuery(test_file_path, query);
284 } 285 }
285 286
286 void RunTest(Browser* browser, 287 void RunTest(content::Shell* window,
287 const std::string& test_case, 288 const std::string& test_case,
288 const std::string& query) { 289 const std::string& query) {
289 GURL url = GetTestURL(test_case, query); 290 GURL url = GetTestURL(test_case, query);
290 const string16 expected_title = ASCIIToUTF16("OK"); 291 const string16 expected_title = ASCIIToUTF16("OK");
291 content::TitleWatcher title_watcher( 292 content::TitleWatcher title_watcher(window->web_contents(), expected_title);
292 chrome::GetActiveWebContents(browser), expected_title); 293 content::NavigateToURL(window, url);
293 ui_test_utils::NavigateToURL(browser, url);
294 string16 final_title = title_watcher.WaitAndGetTitle(); 294 string16 final_title = title_watcher.WaitAndGetTitle();
295 EXPECT_EQ(expected_title, final_title); 295 EXPECT_EQ(expected_title, final_title);
296 } 296 }
297 297
298 void RunTest(const std::string& test_case, const std::string& query) { 298 void RunTest(const std::string& test_case, const std::string& query) {
299 RunTest(browser(), test_case, query); 299 RunTest(shell(), test_case, query);
300 } 300 }
301 301
302 static void CountWorkerProcesses(int *cur_process_count) { 302 static void CountWorkerProcesses(int *cur_process_count) {
303 *cur_process_count = 0; 303 *cur_process_count = 0;
304 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) 304 for (WorkerProcessHostIterator iter; !iter.Done(); ++iter)
305 (*cur_process_count)++; 305 (*cur_process_count)++;
306 BrowserThread::PostTask( 306 BrowserThread::PostTask(
307 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); 307 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure());
308 } 308 }
309 309
310 bool WaitForWorkerProcessCount(int count) { 310 bool WaitForWorkerProcessCount(int count) {
311 int cur_process_count; 311 int cur_process_count;
312 for (int i = 0; i < 100; ++i) { 312 for (int i = 0; i < 100; ++i) {
313 BrowserThread::PostTask( 313 BrowserThread::PostTask(
314 BrowserThread::IO, FROM_HERE, 314 BrowserThread::IO, FROM_HERE,
315 base::Bind(&CountWorkerProcesses, &cur_process_count)); 315 base::Bind(&CountWorkerProcesses, &cur_process_count));
316 ui_test_utils::RunMessageLoop(); 316
317 base::RunLoop run_loop;
318 content::RunThisRunLoop(&run_loop);
317 if (cur_process_count == count) 319 if (cur_process_count == count)
318 return true; 320 return true;
319 321
320 // Sometimes the worker processes can take a while to shut down on the 322 // Sometimes the worker processes can take a while to shut down on the
321 // bots, so use a longer timeout period to avoid spurious failures. 323 // bots, so use a longer timeout period to avoid spurious failures.
322 base::PlatformThread::Sleep(TestTimeouts::action_max_timeout() / 100); 324 base::PlatformThread::Sleep(TestTimeouts::action_max_timeout() / 100);
323 } 325 }
324 326
325 EXPECT_EQ(cur_process_count, count); 327 EXPECT_EQ(cur_process_count, count);
326 return false; 328 return false;
327 } 329 }
330
331 static void QuitUIMessageLoop(base::Callback<void()> callback) {
332 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
333 }
334
335 void NavigateAndWaitForAuth(const GURL& url) {
336 content::ShellContentBrowserClient* browser_client =
337 static_cast<content::ShellContentBrowserClient*>(
338 content::GetContentClient()->browser());
339 scoped_refptr<content::MessageLoopRunner> runner =
340 new content::MessageLoopRunner();
341 browser_client->resource_dispatcher_host_delegate()->
342 set_login_request_callback(
343 base::Bind(&QuitUIMessageLoop, runner->QuitClosure()));
344 shell()->LoadURL(url);
345 runner->Run();
346 }
328 }; 347 };
329 348
330 IN_PROC_BROWSER_TEST_F(WorkerTest, SingleWorker) { 349 IN_PROC_BROWSER_TEST_F(WorkerTest, SingleWorker) {
331 RunTest("single_worker.html", ""); 350 RunTest("single_worker.html", "");
332 } 351 }
333 352
334 IN_PROC_BROWSER_TEST_F(WorkerTest, MultipleWorkers) { 353 IN_PROC_BROWSER_TEST_F(WorkerTest, MultipleWorkers) {
335 RunTest("multi_worker.html", ""); 354 RunTest("multi_worker.html", "");
336 } 355 }
337 356
338 IN_PROC_BROWSER_TEST_F(WorkerTest, SingleSharedWorker) { 357 IN_PROC_BROWSER_TEST_F(WorkerTest, SingleSharedWorker) {
339 RunTest("single_worker.html", "shared=true"); 358 RunTest("single_worker.html", "shared=true");
340 } 359 }
341 360
342 // http://crbug.com/96435 361 // http://crbug.com/96435
343 IN_PROC_BROWSER_TEST_F(WorkerTest, MultipleSharedWorkers) { 362 IN_PROC_BROWSER_TEST_F(WorkerTest, MultipleSharedWorkers) {
344 RunTest("multi_worker.html", "shared=true"); 363 RunTest("multi_worker.html", "shared=true");
345 } 364 }
346 365
347 // Incognito windows should not share workers with non-incognito windows 366 // Incognito windows should not share workers with non-incognito windows
348 // http://crbug.com/30021 367 // http://crbug.com/30021
349 IN_PROC_BROWSER_TEST_F(WorkerTest, IncognitoSharedWorkers) { 368 IN_PROC_BROWSER_TEST_F(WorkerTest, IncognitoSharedWorkers) {
350 // Load a non-incognito tab and have it create a shared worker 369 // Load a non-incognito tab and have it create a shared worker
351 RunTest("incognito_worker.html", ""); 370 RunTest("incognito_worker.html", "");
352 371
353 // Incognito worker should not share with non-incognito 372 // Incognito worker should not share with non-incognito
354 RunTest(CreateIncognitoBrowser(), "incognito_worker.html", ""); 373 RunTest(CreateOffTheRecordBrowser(), "incognito_worker.html", "");
355 } 374 }
356 375
357 // Make sure that auth dialog is displayed from worker context. 376 // Make sure that auth dialog is displayed from worker context.
358 // http://crbug.com/33344 377 // http://crbug.com/33344
359 IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerHttpAuth) { 378 IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerHttpAuth) {
360 ASSERT_TRUE(test_server()->Start()); 379 ASSERT_TRUE(test_server()->Start());
361 GURL url = test_server()->GetURL("files/workers/worker_auth.html"); 380 GURL url = test_server()->GetURL("files/workers/worker_auth.html");
362 381
363 ui_test_utils::NavigateToURLWithDisposition( 382 NavigateAndWaitForAuth(url);
364 browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_AUTH);
365 } 383 }
366 384
367 // Make sure that auth dialog is displayed from shared worker context. 385 // Make sure that auth dialog is displayed from shared worker context.
368 // http://crbug.com/33344 386 // http://crbug.com/33344
369 IN_PROC_BROWSER_TEST_F(WorkerTest, SharedWorkerHttpAuth) { 387 IN_PROC_BROWSER_TEST_F(WorkerTest, SharedWorkerHttpAuth) {
370 ASSERT_TRUE(test_server()->Start()); 388 ASSERT_TRUE(test_server()->Start());
371 GURL url = test_server()->GetURL("files/workers/shared_worker_auth.html"); 389 GURL url = test_server()->GetURL("files/workers/shared_worker_auth.html");
372 ui_test_utils::NavigateToURLWithDisposition( 390 NavigateAndWaitForAuth(url);
373 browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_AUTH);
374 } 391 }
375 392
376 #if defined(OS_LINUX) || defined(OS_CHROMEOS) 393 #if defined(OS_LINUX) || defined(OS_CHROMEOS)
377 // This test is flaky inside the Linux SUID sandbox. 394 // This test is flaky inside the Linux SUID sandbox.
378 // http://crbug.com/130116 395 // http://crbug.com/130116
379 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_LimitPerPage) { 396 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_LimitPerPage) {
380 #else 397 #else
381 IN_PROC_BROWSER_TEST_F(WorkerTest, LimitPerPage) { 398 IN_PROC_BROWSER_TEST_F(WorkerTest, LimitPerPage) {
382 #endif 399 #endif
383 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate; 400 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
384 std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1); 401 std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1);
385 402
386 GURL url = GetTestURL("many_shared_workers.html", query); 403 GURL url = GetTestURL("many_shared_workers.html", query);
387 ui_test_utils::NavigateToURL(browser(), url); 404 content::NavigateToURL(shell(), url);
388 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab)); 405 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
389 } 406 }
390 407
391 #if defined(OS_LINUX) || defined(OS_CHROMEOS) 408 #if defined(OS_LINUX) || defined(OS_CHROMEOS)
392 // This test is flaky inside the Linux SUID sandbox. 409 // This test is flaky inside the Linux SUID sandbox.
393 // http://crbug.com/130116 410 // http://crbug.com/130116
394 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_LimitTotal) { 411 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_LimitTotal) {
395 #else 412 #else
396 // http://crbug.com/36800 413 // http://crbug.com/36800
397 IN_PROC_BROWSER_TEST_F(WorkerTest, LimitTotal) { 414 IN_PROC_BROWSER_TEST_F(WorkerTest, LimitTotal) {
398 #endif 415 #endif
399 if (base::SysInfo::AmountOfPhysicalMemoryMB() < 8192) { 416 if (base::SysInfo::AmountOfPhysicalMemoryMB() < 8192) {
400 LOG(INFO) << "WorkerTest.LimitTotal not running because it needs 8 GB RAM."; 417 LOG(INFO) << "WorkerTest.LimitTotal not running because it needs 8 GB RAM.";
401 return; 418 return;
402 } 419 }
403 420
404 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate; 421 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
405 int total_workers = WorkerServiceImpl::kMaxWorkersWhenSeparate; 422 int total_workers = WorkerServiceImpl::kMaxWorkersWhenSeparate;
406 423
407 std::string query = StringPrintf("?count=%d", max_workers_per_tab); 424 std::string query = StringPrintf("?count=%d", max_workers_per_tab);
408 GURL url = GetTestURL("many_shared_workers.html", query); 425 GURL url = GetTestURL("many_shared_workers.html", query);
409 ui_test_utils::NavigateToURL( 426 content::NavigateToURL(
410 browser(), GURL(url.spec() + StringPrintf("&client_id=0"))); 427 shell(), GURL(url.spec() + StringPrintf("&client_id=0")));
411 428
412 // Adding 1 so that we cause some workers to be queued. 429 // Adding 1 so that we cause some workers to be queued.
413 int tab_count = (total_workers / max_workers_per_tab) + 1; 430 int tab_count = (total_workers / max_workers_per_tab) + 1;
414 for (int i = 1; i < tab_count; ++i) { 431 for (int i = 1; i < tab_count; ++i) {
415 ui_test_utils::NavigateToURLWithDisposition( 432 content::NavigateToURL(
416 browser(), GURL(url.spec() + StringPrintf("&client_id=%d", i)), 433 CreateBrowser(), GURL(url.spec() + StringPrintf("&client_id=%d", i)));
417 NEW_FOREGROUND_TAB,
418 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
419 } 434 }
420 435
421 // Check that we didn't create more than the max number of workers. 436 // Check that we didn't create more than the max number of workers.
422 ASSERT_TRUE(WaitForWorkerProcessCount(total_workers)); 437 ASSERT_TRUE(WaitForWorkerProcessCount(total_workers));
423 438
424 // Now close a page and check that the queued workers were started. 439 // Now close a page and check that the queued workers were started.
425 const FilePath kGoogleDir(FILE_PATH_LITERAL("google")); 440 url = GURL(content::GetTestUrl("google", "google.html"));
426 const FilePath kGoogleFile(FILE_PATH_LITERAL("google.html")); 441 content::NavigateToURL(shell(), url);
427 url = GURL(ui_test_utils::GetTestUrl(kGoogleDir, kGoogleFile));
428 ui_test_utils::NavigateToURL(browser(), url);
429 442
430 ASSERT_TRUE(WaitForWorkerProcessCount(total_workers)); 443 ASSERT_TRUE(WaitForWorkerProcessCount(total_workers));
431 } 444 }
432 445
433 // Flaky, http://crbug.com/59786. 446 // Flaky, http://crbug.com/59786.
434 IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerClose) { 447 IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerClose) {
435 RunTest("worker_close.html", ""); 448 RunTest("worker_close.html", "");
436 ASSERT_TRUE(WaitForWorkerProcessCount(0)); 449 ASSERT_TRUE(WaitForWorkerProcessCount(0));
437 } 450 }
438 451
439 // Flaky, http://crbug.com/70861. 452 // Flaky, http://crbug.com/70861.
440 IN_PROC_BROWSER_TEST_F(WorkerTest, QueuedSharedWorkerShutdown) { 453 IN_PROC_BROWSER_TEST_F(WorkerTest, QueuedSharedWorkerShutdown) {
441 // Tests to make sure that queued shared workers are started up when shared 454 // Tests to make sure that queued shared workers are started up when shared
442 // workers shut down. 455 // workers shut down.
443 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate; 456 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
444 std::string query = StringPrintf("?count=%d", max_workers_per_tab); 457 std::string query = StringPrintf("?count=%d", max_workers_per_tab);
445 RunTest("queued_shared_worker_shutdown.html", query); 458 RunTest("queued_shared_worker_shutdown.html", query);
446 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab)); 459 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
447 } 460 }
448 461
449 // Flaky, http://crbug.com/69881. 462 // Flaky, http://crbug.com/69881.
450 // Sometimes triggers 463 // Sometimes triggers
451 // Check failed: message_ports_[message_port_id].queued_messages.empty(). 464 // Check failed: message_ports_[message_port_id].queued_messages.empty().
452 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_MultipleTabsQueuedSharedWorker) { 465 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_MultipleTabsQueuedSharedWorker) {
453 // Tests to make sure that only one instance of queued shared workers are 466 // Tests to make sure that only one instance of queued shared workers are
454 // started up even when those instances are on multiple tabs. 467 // started up even when those instances are on multiple tabs.
455 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate; 468 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
456 std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1); 469 std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1);
457 GURL url = GetTestURL("many_shared_workers.html", query); 470 GURL url = GetTestURL("many_shared_workers.html", query);
458 ui_test_utils::NavigateToURL(browser(), url); 471 content::NavigateToURL(shell(), url);
459 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab)); 472 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
460 473
461 // Create same set of workers in new tab (leaves one worker queued from this 474 // Create same set of workers in new tab (leaves one worker queued from this
462 // tab). 475 // tab).
463 url = GetTestURL("many_shared_workers.html", query); 476 url = GetTestURL("many_shared_workers.html", query);
464 ui_test_utils::NavigateToURLWithDisposition( 477 content::NavigateToURL(CreateBrowser(), url);
465 browser(), url, NEW_FOREGROUND_TAB,
466 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
467 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab)); 478 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
468 479
469 // Now shutdown one of the shared workers - this will fire both queued 480 // Now shutdown one of the shared workers - this will fire both queued
470 // workers, but only one instance should be started. 481 // workers, but only one instance should be started.
471 url = GetTestURL("shutdown_shared_worker.html", "?id=0"); 482 url = GetTestURL("shutdown_shared_worker.html", "?id=0");
472 ui_test_utils::NavigateToURLWithDisposition( 483 content::NavigateToURL(CreateBrowser(), url);
473 browser(), url, NEW_FOREGROUND_TAB,
474 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
475 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab)); 484 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
476 } 485 }
477 486
478 // Flaky: http://crbug.com/48148 487 // Flaky: http://crbug.com/48148
479 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTa b) { 488 IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTa b) {
480 // Tests to make sure that queued shared workers are started up when 489 // Tests to make sure that queued shared workers are started up when
481 // an instance is launched from another tab. 490 // an instance is launched from another tab.
482 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate; 491 int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
483 std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1); 492 std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1);
484 GURL url = GetTestURL("many_shared_workers.html", query); 493 GURL url = GetTestURL("many_shared_workers.html", query);
485 ui_test_utils::NavigateToURL(browser(), url); 494 content::NavigateToURL(shell(), url);
486 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab)); 495 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
487 496
488 // First window has hit its limit. Now launch second window which creates 497 // First window has hit its limit. Now launch second window which creates
489 // the same worker that was queued in the first window, to ensure it gets 498 // the same worker that was queued in the first window, to ensure it gets
490 // connected to the first window too. 499 // connected to the first window too.
491 query = StringPrintf("?id=%d", max_workers_per_tab); 500 query = StringPrintf("?id=%d", max_workers_per_tab);
492 url = GetTestURL("single_shared_worker.html", query); 501 url = GetTestURL("single_shared_worker.html", query);
493 ui_test_utils::NavigateToURLWithDisposition( 502 content::NavigateToURL(CreateBrowser(), url);
494 browser(), url, NEW_FOREGROUND_TAB,
495 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
496 503
497 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1)); 504 ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1));
498 } 505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698