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

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

Issue 2229693002: ServiceWorker: Re-enable FetchEvent_respondWithRejection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 ASSERT_EQ(messages_.size(), expected_message_count); 404 ASSERT_EQ(messages_.size(), expected_message_count);
405 } 405 }
406 406
407 bool OnMessageReceived(const IPC::Message& message) override { return false; } 407 bool OnMessageReceived(const IPC::Message& message) override { return false; }
408 const std::vector<base::string16>& messages() const { return messages_; } 408 const std::vector<base::string16>& messages() const { return messages_; }
409 409
410 private: 410 private:
411 void OnReportConsoleMessageOnUI(const base::string16& message) { 411 void OnReportConsoleMessageOnUI(const base::string16& message) {
412 DCHECK_CURRENTLY_ON(BrowserThread::UI); 412 DCHECK_CURRENTLY_ON(BrowserThread::UI);
413 messages_.push_back(message); 413 messages_.push_back(message);
414 if (messages_.size() == expected_message_count_) 414 if (!quit_.is_null() && messages_.size() == expected_message_count_)
415 quit_.Run(); 415 quit_.Run();
416 } 416 }
417 417
418 // These parameters must be accessed on the UI thread. 418 // These parameters must be accessed on the UI thread.
419 std::vector<base::string16> messages_; 419 std::vector<base::string16> messages_;
420 size_t expected_message_count_; 420 size_t expected_message_count_ = 0;
421 base::Closure quit_; 421 base::Closure quit_;
422 }; 422 };
423 423
424 class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { 424 class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest {
425 public: 425 public:
426 using self = ServiceWorkerVersionBrowserTest; 426 using self = ServiceWorkerVersionBrowserTest;
427 427
428 ~ServiceWorkerVersionBrowserTest() override {} 428 ~ServiceWorkerVersionBrowserTest() override {}
429 429
430 void TearDownOnIOThread() override { 430 void TearDownOnIOThread() override {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 1108
1109 FetchOnRegisteredWorker(&result, &response2, &blob_data_handle); 1109 FetchOnRegisteredWorker(&result, &response2, &blob_data_handle);
1110 ASSERT_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, result); 1110 ASSERT_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, result);
1111 EXPECT_EQ(200, response2.status_code); 1111 EXPECT_EQ(200, response2.status_code);
1112 EXPECT_EQ("OK", response2.status_text); 1112 EXPECT_EQ("OK", response2.status_text);
1113 EXPECT_EQ(response1.response_time, response2.response_time); 1113 EXPECT_EQ(response1.response_time, response2.response_time);
1114 EXPECT_TRUE(response2.is_in_cache_storage); 1114 EXPECT_TRUE(response2.is_in_cache_storage);
1115 EXPECT_EQ("cache_name", response2.cache_storage_cache_name); 1115 EXPECT_EQ("cache_name", response2.cache_storage_cache_name);
1116 } 1116 }
1117 1117
1118 // Disabled because console_listener->OnReportConsoleMessageOnUI() will be
1119 // called before WaitForConsoleMessages() is called to set the expected number
1120 // of messages. https://crbug.com/635599
1121 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, 1118 IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
1122 DISABLED_FetchEvent_respondWithRejection) { 1119 FetchEvent_respondWithRejection) {
1123 ServiceWorkerFetchEventResult result; 1120 ServiceWorkerFetchEventResult result;
1124 ServiceWorkerResponse response; 1121 ServiceWorkerResponse response;
1125 std::unique_ptr<storage::BlobDataHandle> blob_data_handle; 1122 std::unique_ptr<storage::BlobDataHandle> blob_data_handle;
1126 1123
1127 RunOnIOThread(base::Bind(&self::SetUpRegistrationOnIOThread, 1124 RunOnIOThread(base::Bind(&self::SetUpRegistrationOnIOThread,
1128 base::Unretained(this), 1125 base::Unretained(this),
1129 "/service_worker/fetch_event_rejected.js")); 1126 "/service_worker/fetch_event_rejected.js"));
1130 1127
1131 ConsoleListener console_listener; 1128 ConsoleListener console_listener;
1132 RunOnIOThread(base::Bind(&EmbeddedWorkerInstance::AddListener, 1129 RunOnIOThread(base::Bind(&EmbeddedWorkerInstance::AddListener,
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 2022
2026 IN_PROC_BROWSER_TEST_F(ServiceWorkerDisableWebSecurityTest, UpdateNoCrash) { 2023 IN_PROC_BROWSER_TEST_F(ServiceWorkerDisableWebSecurityTest, UpdateNoCrash) {
2027 const char kPageUrl[] = "/service_worker/disable_web_security_update.html"; 2024 const char kPageUrl[] = "/service_worker/disable_web_security_update.html";
2028 const char kScopeUrl[] = "/service_worker/scope/"; 2025 const char kScopeUrl[] = "/service_worker/scope/";
2029 const char kWorkerUrl[] = "/service_worker/fetch_event_blob.js"; 2026 const char kWorkerUrl[] = "/service_worker/fetch_event_blob.js";
2030 RegisterServiceWorkerOnCrossOriginServer(kScopeUrl, kWorkerUrl); 2027 RegisterServiceWorkerOnCrossOriginServer(kScopeUrl, kWorkerUrl);
2031 RunTestWithCrossOriginURL(kPageUrl, kScopeUrl); 2028 RunTestWithCrossOriginURL(kPageUrl, kScopeUrl);
2032 } 2029 }
2033 2030
2034 } // namespace content 2031 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698