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/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 PlatformThread::Sleep(sleep_timeout_ms() / 10); | 97 PlatformThread::Sleep(sleep_timeout_ms() / 10); |
98 } | 98 } |
99 | 99 |
100 EXPECT_EQ(number_of_processes, cur_process_count); | 100 EXPECT_EQ(number_of_processes, cur_process_count); |
101 return false; | 101 return false; |
102 } | 102 } |
103 | 103 |
104 void RunWorkerFastLayoutTest(const std::string& test_case_file_name) { | 104 void RunWorkerFastLayoutTest(const std::string& test_case_file_name) { |
105 FilePath fast_test_dir; | 105 FilePath fast_test_dir; |
106 fast_test_dir = fast_test_dir.AppendASCII("LayoutTests"); | |
107 fast_test_dir = fast_test_dir.AppendASCII("fast"); | 106 fast_test_dir = fast_test_dir.AppendASCII("fast"); |
108 | 107 |
109 FilePath worker_test_dir; | 108 FilePath worker_test_dir; |
110 worker_test_dir = worker_test_dir.AppendASCII("workers"); | 109 worker_test_dir = worker_test_dir.AppendASCII("workers"); |
111 InitializeForLayoutTest(fast_test_dir, worker_test_dir, kNoHttpPort); | 110 InitializeForLayoutTest(fast_test_dir, worker_test_dir, kNoHttpPort); |
112 | 111 |
113 // Worker tests also rely on common files in js/resources. | 112 // Worker tests also rely on common files in js/resources. |
114 FilePath js_dir = fast_test_dir.AppendASCII("js"); | 113 FilePath js_dir = fast_test_dir.AppendASCII("js"); |
115 FilePath resource_dir; | 114 FilePath resource_dir; |
116 resource_dir = resource_dir.AppendASCII("resources"); | 115 resource_dir = resource_dir.AppendASCII("resources"); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // flakey? BUG 16934 "text-encoding.html", | 380 // flakey? BUG 16934 "text-encoding.html", |
382 #if defined(OS_WIN) | 381 #if defined(OS_WIN) |
383 // Fails on the mac (and linux?): | 382 // Fails on the mac (and linux?): |
384 // http://code.google.com/p/chromium/issues/detail?id=22599 | 383 // http://code.google.com/p/chromium/issues/detail?id=22599 |
385 "worker-importScripts.html", | 384 "worker-importScripts.html", |
386 #endif | 385 #endif |
387 "worker-redirect.html", | 386 "worker-redirect.html", |
388 }; | 387 }; |
389 | 388 |
390 FilePath http_test_dir; | 389 FilePath http_test_dir; |
391 http_test_dir = http_test_dir.AppendASCII("LayoutTests"); | |
392 http_test_dir = http_test_dir.AppendASCII("http"); | 390 http_test_dir = http_test_dir.AppendASCII("http"); |
393 http_test_dir = http_test_dir.AppendASCII("tests"); | 391 http_test_dir = http_test_dir.AppendASCII("tests"); |
394 | 392 |
395 FilePath worker_test_dir; | 393 FilePath worker_test_dir; |
396 worker_test_dir = worker_test_dir.AppendASCII("workers"); | 394 worker_test_dir = worker_test_dir.AppendASCII("workers"); |
397 InitializeForLayoutTest(http_test_dir, worker_test_dir, kHttpPort); | 395 InitializeForLayoutTest(http_test_dir, worker_test_dir, kHttpPort); |
398 | 396 |
399 StartHttpServer(new_http_root_dir_); | 397 StartHttpServer(new_http_root_dir_); |
400 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) | 398 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) |
401 RunLayoutTest(kLayoutTestFiles[i], kHttpPort); | 399 RunLayoutTest(kLayoutTestFiles[i], kHttpPort); |
402 StopHttpServer(); | 400 StopHttpServer(); |
403 } | 401 } |
404 | 402 |
405 TEST_F(WorkerTest, WorkerWebSocketLayoutTests) { | 403 TEST_F(WorkerTest, WorkerWebSocketLayoutTests) { |
406 static const char* kLayoutTestFiles[] = { | 404 static const char* kLayoutTestFiles[] = { |
407 "worker-simple.html", | 405 "worker-simple.html", |
408 "shared-worker-simple.html", | 406 "shared-worker-simple.html", |
409 }; | 407 }; |
410 | 408 |
411 FilePath websocket_test_dir; | 409 FilePath websocket_test_dir; |
412 websocket_test_dir = websocket_test_dir.AppendASCII("LayoutTests"); | |
413 websocket_test_dir = websocket_test_dir.AppendASCII("websocket"); | 410 websocket_test_dir = websocket_test_dir.AppendASCII("websocket"); |
414 websocket_test_dir = websocket_test_dir.AppendASCII("tests"); | 411 websocket_test_dir = websocket_test_dir.AppendASCII("tests"); |
415 | 412 |
416 FilePath worker_test_dir; | 413 FilePath worker_test_dir; |
417 worker_test_dir = worker_test_dir.AppendASCII("workers"); | 414 worker_test_dir = worker_test_dir.AppendASCII("workers"); |
418 InitializeForLayoutTest(websocket_test_dir, worker_test_dir, kWebSocketPort); | 415 InitializeForLayoutTest(websocket_test_dir, worker_test_dir, kWebSocketPort); |
419 test_case_dir_ = test_case_dir_.AppendASCII("websocket"); | 416 test_case_dir_ = test_case_dir_.AppendASCII("websocket"); |
420 test_case_dir_ = test_case_dir_.AppendASCII("tests"); | 417 test_case_dir_ = test_case_dir_.AppendASCII("tests"); |
421 test_case_dir_ = test_case_dir_.AppendASCII("workers"); | 418 test_case_dir_ = test_case_dir_.AppendASCII("workers"); |
422 | 419 |
(...skipping 20 matching lines...) Expand all Loading... |
443 // Disabled due to limitations in lighttpd (does not handle methods other | 440 // Disabled due to limitations in lighttpd (does not handle methods other |
444 // than GET/PUT/POST). | 441 // than GET/PUT/POST). |
445 // "shared-worker-methods-async.html", | 442 // "shared-worker-methods-async.html", |
446 // "shared-worker-methods.html", | 443 // "shared-worker-methods.html", |
447 "shared-worker-xhr-file-not-found.html", | 444 "shared-worker-xhr-file-not-found.html", |
448 | 445 |
449 "xmlhttprequest-file-not-found.html" | 446 "xmlhttprequest-file-not-found.html" |
450 }; | 447 }; |
451 | 448 |
452 FilePath http_test_dir; | 449 FilePath http_test_dir; |
453 http_test_dir = http_test_dir.AppendASCII("LayoutTests"); | |
454 http_test_dir = http_test_dir.AppendASCII("http"); | 450 http_test_dir = http_test_dir.AppendASCII("http"); |
455 http_test_dir = http_test_dir.AppendASCII("tests"); | 451 http_test_dir = http_test_dir.AppendASCII("tests"); |
456 | 452 |
457 FilePath worker_test_dir; | 453 FilePath worker_test_dir; |
458 worker_test_dir = worker_test_dir.AppendASCII("xmlhttprequest"); | 454 worker_test_dir = worker_test_dir.AppendASCII("xmlhttprequest"); |
459 worker_test_dir = worker_test_dir.AppendASCII("workers"); | 455 worker_test_dir = worker_test_dir.AppendASCII("workers"); |
460 InitializeForLayoutTest(http_test_dir, worker_test_dir, kHttpPort); | 456 InitializeForLayoutTest(http_test_dir, worker_test_dir, kHttpPort); |
461 | 457 |
462 StartHttpServer(new_http_root_dir_); | 458 StartHttpServer(new_http_root_dir_); |
463 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) | 459 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) |
(...skipping 14 matching lines...) Expand all Loading... |
478 "message-port-deleted-document.html", | 474 "message-port-deleted-document.html", |
479 "message-port-deleted-frame.html", | 475 "message-port-deleted-frame.html", |
480 "message-port-inactive-document.html", | 476 "message-port-inactive-document.html", |
481 "message-port-multi.html", | 477 "message-port-multi.html", |
482 "message-port-no-wrapper.html", | 478 "message-port-no-wrapper.html", |
483 // Only works with run-webkit-tests --leaks. | 479 // Only works with run-webkit-tests --leaks. |
484 // "message-channel-listener-circular-ownership.html", | 480 // "message-channel-listener-circular-ownership.html", |
485 }; | 481 }; |
486 | 482 |
487 FilePath fast_test_dir; | 483 FilePath fast_test_dir; |
488 fast_test_dir = fast_test_dir.AppendASCII("LayoutTests"); | |
489 fast_test_dir = fast_test_dir.AppendASCII("fast"); | 484 fast_test_dir = fast_test_dir.AppendASCII("fast"); |
490 | 485 |
491 FilePath worker_test_dir; | 486 FilePath worker_test_dir; |
492 worker_test_dir = worker_test_dir.AppendASCII("events"); | 487 worker_test_dir = worker_test_dir.AppendASCII("events"); |
493 InitializeForLayoutTest(fast_test_dir, worker_test_dir, kNoHttpPort); | 488 InitializeForLayoutTest(fast_test_dir, worker_test_dir, kNoHttpPort); |
494 | 489 |
495 // MessagePort tests also rely on common files in js/resources. | 490 // MessagePort tests also rely on common files in js/resources. |
496 FilePath js_dir = fast_test_dir.AppendASCII("js"); | 491 FilePath js_dir = fast_test_dir.AppendASCII("js"); |
497 FilePath resource_dir; | 492 FilePath resource_dir; |
498 resource_dir = resource_dir.AppendASCII("resources"); | 493 resource_dir = resource_dir.AppendASCII("resources"); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 GURL url2 = ui_test_utils::GetTestUrl(FilePath(kTestDir), | 629 GURL url2 = ui_test_utils::GetTestUrl(FilePath(kTestDir), |
635 FilePath(kSingleSharedWorkersFile)); | 630 FilePath(kSingleSharedWorkersFile)); |
636 url2 = GURL(url2.spec() + StringPrintf("?id=%d", max_workers_per_tab)); | 631 url2 = GURL(url2.spec() + StringPrintf("?id=%d", max_workers_per_tab)); |
637 ASSERT_TRUE(window->AppendTab(url2)); | 632 ASSERT_TRUE(window->AppendTab(url2)); |
638 | 633 |
639 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, | 634 std::string value = WaitUntilCookieNonEmpty(tab.get(), url, |
640 kTestCompleteCookie, action_max_timeout_ms()); | 635 kTestCompleteCookie, action_max_timeout_ms()); |
641 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); | 636 ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); |
642 ASSERT_TRUE(WaitForProcessCountToBe(2, max_workers_per_tab+1)); | 637 ASSERT_TRUE(WaitForProcessCountToBe(2, max_workers_per_tab+1)); |
643 } | 638 } |
OLD | NEW |