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

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

Issue 2628553002: ServiceWorker: OnSimpleEventFinished could be called after timed out (Closed)
Patch Set: Fix comments Created 3 years, 11 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 | content/browser/service_worker/embedded_worker_test_helper.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 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/browser/service_worker/embedded_worker_instance.h" 5 #include "content/browser/service_worker/embedded_worker_instance.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstanceTest); 146 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstanceTest);
147 }; 147 };
148 148
149 // A helper to simulate the start worker sequence is stalled in a worker 149 // A helper to simulate the start worker sequence is stalled in a worker
150 // process. 150 // process.
151 class StalledInStartWorkerHelper : public EmbeddedWorkerTestHelper { 151 class StalledInStartWorkerHelper : public EmbeddedWorkerTestHelper {
152 public: 152 public:
153 StalledInStartWorkerHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} 153 StalledInStartWorkerHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {}
154 ~StalledInStartWorkerHelper() override{}; 154 ~StalledInStartWorkerHelper() override{};
155 155
156 void OnStartWorker(int embedded_worker_id, 156 void OnStartWorker(
157 int64_t service_worker_version_id, 157 int embedded_worker_id,
158 const GURL& scope, 158 int64_t service_worker_version_id,
159 const GURL& script_url, 159 const GURL& scope,
160 bool pause_after_download) override { 160 const GURL& script_url,
161 bool pause_after_download,
162 mojom::ServiceWorkerEventDispatcherRequest request) override {
161 if (force_stall_in_start_) { 163 if (force_stall_in_start_) {
162 // Do nothing to simulate a stall in the worker process. 164 // Do nothing to simulate a stall in the worker process.
163 return; 165 return;
164 } 166 }
165 EmbeddedWorkerTestHelper::OnStartWorker(embedded_worker_id, 167 EmbeddedWorkerTestHelper::OnStartWorker(
166 service_worker_version_id, scope, 168 embedded_worker_id, service_worker_version_id, scope, script_url,
167 script_url, pause_after_download); 169 pause_after_download, std::move(request));
168 } 170 }
169 171
170 void set_force_stall_in_start(bool force_stall_in_start) { 172 void set_force_stall_in_start(bool force_stall_in_start) {
171 force_stall_in_start_ = force_stall_in_start; 173 force_stall_in_start_ = force_stall_in_start;
172 } 174 }
173 175
174 private: 176 private:
175 bool force_stall_in_start_ = true; 177 bool force_stall_in_start_ = true;
176 }; 178 };
177 179
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 719
718 // Worker should handle the sudden shutdown as detach. 720 // Worker should handle the sudden shutdown as detach.
719 ASSERT_EQ(3u, events_.size()); 721 ASSERT_EQ(3u, events_.size());
720 EXPECT_EQ(PROCESS_ALLOCATED, events_[0].type); 722 EXPECT_EQ(PROCESS_ALLOCATED, events_[0].type);
721 EXPECT_EQ(START_WORKER_MESSAGE_SENT, events_[1].type); 723 EXPECT_EQ(START_WORKER_MESSAGE_SENT, events_[1].type);
722 EXPECT_EQ(DETACHED, events_[2].type); 724 EXPECT_EQ(DETACHED, events_[2].type);
723 EXPECT_EQ(EmbeddedWorkerStatus::STARTING, events_[2].status); 725 EXPECT_EQ(EmbeddedWorkerStatus::STARTING, events_[2].status);
724 } 726 }
725 727
726 } // namespace content 728 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698