OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/service_worker/embedded_worker_instance.h" | 9 #include "content/browser/service_worker/embedded_worker_instance.h" |
10 #include "content/browser/service_worker/embedded_worker_registry.h" | 10 #include "content/browser/service_worker/embedded_worker_registry.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 ActivateTestHelper("/service_worker/worker_activate_rejected.js", | 456 ActivateTestHelper("/service_worker/worker_activate_rejected.js", |
457 SERVICE_WORKER_ERROR_ACTIVATE_WORKER_FAILED); | 457 SERVICE_WORKER_ERROR_ACTIVATE_WORKER_FAILED); |
458 } | 458 } |
459 | 459 |
460 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, | 460 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, |
461 InstallWithWaitUntil_Rejected) { | 461 InstallWithWaitUntil_Rejected) { |
462 InstallTestHelper("/service_worker/worker_install_rejected.js", | 462 InstallTestHelper("/service_worker/worker_install_rejected.js", |
463 SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); | 463 SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED); |
464 } | 464 } |
465 | 465 |
466 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, FetchEvent_Response) { | 466 // TODO(kinuko): Re-enable this test once blink-side patch is rolled for |
| 467 // http://crbug.com/376733 |
| 468 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, |
| 469 DISABLED_FetchEvent_Response) { |
467 ServiceWorkerFetchEventResult result; | 470 ServiceWorkerFetchEventResult result; |
468 ServiceWorkerResponse response; | 471 ServiceWorkerResponse response; |
469 FetchTestHelper("/service_worker/fetch_event.js", &result, &response); | 472 FetchTestHelper("/service_worker/fetch_event.js", &result, &response); |
470 ASSERT_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, result); | 473 ASSERT_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, result); |
471 EXPECT_EQ(200, response.status_code); | 474 EXPECT_EQ(301, response.status_code); |
472 EXPECT_EQ("OK", response.status_text); | 475 EXPECT_EQ("Moved Permanently", response.status_text); |
473 EXPECT_EQ("GET", response.method); | |
474 std::map<std::string, std::string> expected_headers; | 476 std::map<std::string, std::string> expected_headers; |
| 477 expected_headers["Content-Language"] = "fi"; |
| 478 expected_headers["Content-Type"] = "text/html; charset=UTF-8"; |
475 EXPECT_EQ(expected_headers, response.headers); | 479 EXPECT_EQ(expected_headers, response.headers); |
476 } | 480 } |
477 | 481 |
478 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, | 482 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, |
479 FetchEvent_FallbackToNative) { | 483 FetchEvent_FallbackToNative) { |
480 ServiceWorkerFetchEventResult result; | 484 ServiceWorkerFetchEventResult result; |
481 ServiceWorkerResponse response; | 485 ServiceWorkerResponse response; |
482 FetchTestHelper( | 486 FetchTestHelper( |
483 "/service_worker/fetch_event_fallback.js", &result, &response); | 487 "/service_worker/fetch_event_fallback.js", &result, &response); |
484 ASSERT_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, result); | 488 ASSERT_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, result); |
(...skipping 17 matching lines...) Expand all Loading... |
502 BrowserThread::PostTask(BrowserThread::IO, | 506 BrowserThread::PostTask(BrowserThread::IO, |
503 FROM_HERE, | 507 FROM_HERE, |
504 base::Bind(&self::SyncEventOnIOThread, | 508 base::Bind(&self::SyncEventOnIOThread, |
505 this, | 509 this, |
506 sync_run_loop.QuitClosure(), | 510 sync_run_loop.QuitClosure(), |
507 &status)); | 511 &status)); |
508 sync_run_loop.Run(); | 512 sync_run_loop.Run(); |
509 ASSERT_EQ(SERVICE_WORKER_ERROR_ABORT, status); | 513 ASSERT_EQ(SERVICE_WORKER_ERROR_ABORT, status); |
510 } | 514 } |
511 | 515 |
512 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, SyncEventHandled) { | 516 // TODO(kinuko): Re-enable this test once blink-side patch is rolled for |
| 517 // http://crbug.com/376733 |
| 518 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, |
| 519 DISABLED_SyncEventHandled) { |
513 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 520 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
514 command_line->AppendSwitch(switches::kEnableServiceWorkerSync); | 521 command_line->AppendSwitch(switches::kEnableServiceWorkerSync); |
515 | 522 |
516 RunOnIOThread(base::Bind( | 523 RunOnIOThread(base::Bind( |
517 &self::SetUpRegistrationOnIOThread, this, "/service_worker/sync.js")); | 524 &self::SetUpRegistrationOnIOThread, this, "/service_worker/sync.js")); |
518 ServiceWorkerFetchEventResult result; | 525 ServiceWorkerFetchEventResult result; |
519 ServiceWorkerResponse response; | 526 ServiceWorkerResponse response; |
520 | 527 |
521 // Should 404 before sync event. | 528 // Should 404 before sync event. |
522 FetchOnRegisteredWorker(&result, &response); | 529 FetchOnRegisteredWorker(&result, &response); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, | 679 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, |
673 this, | 680 this, |
674 embedded_test_server()->GetURL("/service_worker/empty.html"), | 681 embedded_test_server()->GetURL("/service_worker/empty.html"), |
675 &status, | 682 &status, |
676 &script_url)); | 683 &script_url)); |
677 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); | 684 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); |
678 } | 685 } |
679 } | 686 } |
680 | 687 |
681 } // namespace content | 688 } // namespace content |
OLD | NEW |