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

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

Issue 2787883003: [ServiceWorker] Add EmbeddedWorkerInstanceHost Interface. (Closed)
Patch Set: Fix test: ServiceWorkerContextTest.UnregisterMultiple Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/public/browser/service_worker_context.h" 5 #include "content/public/browser/service_worker_context.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 public: 169 public:
170 enum class Message { StartWorker, StopWorker }; 170 enum class Message { StartWorker, StopWorker };
171 171
172 explicit RecordableEmbeddedWorkerInstanceClient( 172 explicit RecordableEmbeddedWorkerInstanceClient(
173 base::WeakPtr<EmbeddedWorkerTestHelper> helper) 173 base::WeakPtr<EmbeddedWorkerTestHelper> helper)
174 : EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient(helper) {} 174 : EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient(helper) {}
175 175
176 const std::vector<Message>& events() const { return events_; } 176 const std::vector<Message>& events() const { return events_; }
177 177
178 protected: 178 protected:
179 void StartWorker( 179 void StartWorker(const EmbeddedWorkerStartParams& params,
180 const EmbeddedWorkerStartParams& params, 180 mojom::ServiceWorkerEventDispatcherRequest request,
181 mojom::ServiceWorkerEventDispatcherRequest request) override { 181 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo
182 instance_host) override {
182 events_.push_back(Message::StartWorker); 183 events_.push_back(Message::StartWorker);
183 EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( 184 EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker(
184 params, std::move(request)); 185 params, std::move(request), std::move(instance_host));
185 } 186 }
186 187
187 void StopWorker(const StopWorkerCallback& callback) override { 188 void StopWorker(const StopWorkerCallback& callback) override {
188 events_.push_back(Message::StopWorker); 189 events_.push_back(Message::StopWorker);
189 EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StopWorker( 190 EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StopWorker(
190 std::move(callback)); 191 std::move(callback));
191 } 192 }
192 193
193 std::vector<Message> events_; 194 std::vector<Message> events_;
194 195
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 EXPECT_EQ(origin1_p1, notifications_[0].pattern); 482 EXPECT_EQ(origin1_p1, notifications_[0].pattern);
482 EXPECT_EQ(REGISTRATION_STORED, notifications_[1].type); 483 EXPECT_EQ(REGISTRATION_STORED, notifications_[1].type);
483 EXPECT_EQ(origin1_p2, notifications_[1].pattern); 484 EXPECT_EQ(origin1_p2, notifications_[1].pattern);
484 EXPECT_EQ(registration_id2, notifications_[1].registration_id); 485 EXPECT_EQ(registration_id2, notifications_[1].registration_id);
485 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); 486 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type);
486 EXPECT_EQ(origin2_p1, notifications_[2].pattern); 487 EXPECT_EQ(origin2_p1, notifications_[2].pattern);
487 EXPECT_EQ(registration_id3, notifications_[2].registration_id); 488 EXPECT_EQ(registration_id3, notifications_[2].registration_id);
488 EXPECT_EQ(REGISTRATION_STORED, notifications_[3].type); 489 EXPECT_EQ(REGISTRATION_STORED, notifications_[3].type);
489 EXPECT_EQ(origin3_p1, notifications_[3].pattern); 490 EXPECT_EQ(origin3_p1, notifications_[3].pattern);
490 EXPECT_EQ(registration_id4, notifications_[3].registration_id); 491 EXPECT_EQ(registration_id4, notifications_[3].registration_id);
492
shimazu 2017/04/06 05:01:36 Could you remote this extra line?
leonhsl(Using Gerrit) 2017/04/06 09:58:55 Done.
491 EXPECT_EQ(REGISTRATION_DELETED, notifications_[4].type); 493 EXPECT_EQ(REGISTRATION_DELETED, notifications_[4].type);
492 EXPECT_EQ(origin1_p2, notifications_[4].pattern); 494 EXPECT_EQ(origin1_p2, notifications_[4].pattern);
493 EXPECT_EQ(registration_id2, notifications_[4].registration_id); 495 EXPECT_EQ(registration_id2, notifications_[4].registration_id);
494 EXPECT_EQ(REGISTRATION_DELETED, notifications_[5].type); 496 EXPECT_EQ(REGISTRATION_DELETED, notifications_[5].type);
495 EXPECT_EQ(origin1_p1, notifications_[5].pattern); 497 EXPECT_EQ(origin1_p1, notifications_[5].pattern);
496 EXPECT_EQ(registration_id1, notifications_[5].registration_id); 498 EXPECT_EQ(registration_id1, notifications_[5].registration_id);
497 } 499 }
498 500
499 // Make sure registering a new script shares an existing registration. 501 // Make sure registering a new script shares an existing registration.
500 TEST_F(ServiceWorkerContextTest, RegisterNewScript) { 502 TEST_F(ServiceWorkerContextTest, RegisterNewScript) {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); 763 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type);
762 EXPECT_EQ(pattern, notifications_[2].pattern); 764 EXPECT_EQ(pattern, notifications_[2].pattern);
763 EXPECT_EQ(registration_id, notifications_[2].registration_id); 765 EXPECT_EQ(registration_id, notifications_[2].registration_id);
764 } 766 }
765 767
766 INSTANTIATE_TEST_CASE_P(ServiceWorkerContextRecoveryTest, 768 INSTANTIATE_TEST_CASE_P(ServiceWorkerContextRecoveryTest,
767 ServiceWorkerContextRecoveryTest, 769 ServiceWorkerContextRecoveryTest,
768 testing::Bool()); 770 testing::Bool());
769 771
770 } // namespace content 772 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698