| OLD | NEW |
| 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 Loading... |
| 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() 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 } | 191 } |
| 192 | 192 |
| 193 std::vector<Message> events_; | 193 std::vector<Message> events_; |
| 194 | 194 |
| 195 private: | 195 private: |
| 196 DISALLOW_COPY_AND_ASSIGN(RecordableEmbeddedWorkerInstanceClient); | 196 DISALLOW_COPY_AND_ASSIGN(RecordableEmbeddedWorkerInstanceClient); |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 // Make sure basic registration is working. | 199 // Make sure basic registration is working. |
| 200 TEST_F(ServiceWorkerContextTest, Register) { | 200 TEST_F(ServiceWorkerContextTest, Register) { |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); | 761 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); |
| 762 EXPECT_EQ(pattern, notifications_[2].pattern); | 762 EXPECT_EQ(pattern, notifications_[2].pattern); |
| 763 EXPECT_EQ(registration_id, notifications_[2].registration_id); | 763 EXPECT_EQ(registration_id, notifications_[2].registration_id); |
| 764 } | 764 } |
| 765 | 765 |
| 766 INSTANTIATE_TEST_CASE_P(ServiceWorkerContextRecoveryTest, | 766 INSTANTIATE_TEST_CASE_P(ServiceWorkerContextRecoveryTest, |
| 767 ServiceWorkerContextRecoveryTest, | 767 ServiceWorkerContextRecoveryTest, |
| 768 testing::Bool()); | 768 testing::Bool()); |
| 769 | 769 |
| 770 } // namespace content | 770 } // namespace content |
| OLD | NEW |