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

Side by Side Diff: content/browser/service_worker/service_worker_browsertest.cc

Issue 299003002: ServiceWorker: support Response.{status,statusText,headers} [chromium] (1/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | content/common/service_worker/service_worker_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 thist test once blink-side patch is rolled for
jsbell 2014/05/23 21:05:06 typo: 'thist'
kinuko 2014/05/26 02:35:48 Done.
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 Permently", response.status_text);
falken 2014/05/24 14:49:51 typo "Permently"
kinuko 2014/05/26 02:35:48 Oops... done.
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
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 thist test once blink-side patch is rolled for
jsbell 2014/05/23 21:05:06 typo: 'thist'
kinuko 2014/05/26 02:35:48 Done.
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, 652 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO,
646 this, 653 this,
647 embedded_test_server()->GetURL("/service_worker/empty.html"), 654 embedded_test_server()->GetURL("/service_worker/empty.html"),
648 &status, 655 &status,
649 &script_url)); 656 &script_url));
650 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); 657 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status);
651 } 658 }
652 } 659 }
653 660
654 } // namespace content 661 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/service_worker/service_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698