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

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

Issue 1675613002: service worker: use 200 OK for update requests even in the no update case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asan and fix win compile? Created 4 years, 10 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 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/browser/message_port_service.h" 9 #include "content/browser/message_port_service.h"
10 #include "content/browser/service_worker/embedded_worker_registry.h" 10 #include "content/browser/service_worker/embedded_worker_registry.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 public: 283 public:
284 MessageReceiverDisallowStart() 284 MessageReceiverDisallowStart()
285 : MessageReceiver() {} 285 : MessageReceiver() {}
286 ~MessageReceiverDisallowStart() override {} 286 ~MessageReceiverDisallowStart() override {}
287 287
288 enum class StartMode { STALL, FAIL, SUCCEED }; 288 enum class StartMode { STALL, FAIL, SUCCEED };
289 289
290 void OnStartWorker(int embedded_worker_id, 290 void OnStartWorker(int embedded_worker_id,
291 int64_t service_worker_version_id, 291 int64_t service_worker_version_id,
292 const GURL& scope, 292 const GURL& scope,
293 const GURL& script_url) override { 293 const GURL& script_url,
294 bool pause_after_download) override {
294 switch (mode_) { 295 switch (mode_) {
295 case StartMode::STALL: 296 case StartMode::STALL:
296 break; // Do nothing. 297 break; // Do nothing.
297 case StartMode::FAIL: 298 case StartMode::FAIL:
298 OnStopWorker(embedded_worker_id); 299 OnStopWorker(embedded_worker_id);
299 break; 300 break;
300 case StartMode::SUCCEED: 301 case StartMode::SUCCEED:
301 MessageReceiver::OnStartWorker( 302 MessageReceiver::OnStartWorker(embedded_worker_id,
302 embedded_worker_id, service_worker_version_id, scope, script_url); 303 service_worker_version_id, scope,
304 script_url, pause_after_download);
303 break; 305 break;
304 } 306 }
305 } 307 }
306 308
307 void set_start_mode(StartMode mode) { mode_ = mode; } 309 void set_start_mode(StartMode mode) { mode_ = mode; }
308 310
309 private: 311 private:
310 StartMode mode_ = StartMode::STALL; 312 StartMode mode_ = StartMode::STALL;
311 DISALLOW_COPY_AND_ASSIGN(MessageReceiverDisallowStart); 313 DISALLOW_COPY_AND_ASSIGN(MessageReceiverDisallowStart);
312 }; 314 };
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 helper_->SimulateSendSimpleEventResult( 1430 helper_->SimulateSendSimpleEventResult(
1429 version_->embedded_worker()->embedded_worker_id(), request_id, 1431 version_->embedded_worker()->embedded_worker_id(), request_id,
1430 blink::WebServiceWorkerEventResultRejected); 1432 blink::WebServiceWorkerEventResultRejected);
1431 runner->Run(); 1433 runner->Run();
1432 1434
1433 // Verify callback was called with correct status. 1435 // Verify callback was called with correct status.
1434 EXPECT_EQ(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, status); 1436 EXPECT_EQ(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, status);
1435 } 1437 }
1436 1438
1437 } // namespace content 1439 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698