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

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

Issue 739383002: Don't drop messages/events send to a service worker that is stopping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@termnate_sw
Patch Set: address nit Created 6 years 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" 10 #include "content/browser/fileapi/chrome_blob_storage_context.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 protected: 371 protected:
372 // EmbeddedWorkerInstance::Observer overrides: 372 // EmbeddedWorkerInstance::Observer overrides:
373 void OnStarted() override { 373 void OnStarted() override {
374 ASSERT_TRUE(worker_ != NULL); 374 ASSERT_TRUE(worker_ != NULL);
375 ASSERT_FALSE(done_closure_.is_null()); 375 ASSERT_FALSE(done_closure_.is_null());
376 last_worker_status_ = worker_->status(); 376 last_worker_status_ = worker_->status();
377 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); 377 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_);
378 } 378 }
379 void OnStopped() override { 379 void OnStopped(EmbeddedWorkerInstance::Status old_status) override {
380 ASSERT_TRUE(worker_ != NULL); 380 ASSERT_TRUE(worker_ != NULL);
381 ASSERT_FALSE(done_closure_.is_null()); 381 ASSERT_FALSE(done_closure_.is_null());
382 last_worker_status_ = worker_->status(); 382 last_worker_status_ = worker_->status();
383 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); 383 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_);
384 } 384 }
385 void OnPausedAfterDownload() override { 385 void OnPausedAfterDownload() override {
386 if (pause_mode_ == PAUSE_THEN_RESUME) 386 if (pause_mode_ == PAUSE_THEN_RESUME)
387 worker_->ResumeAfterDownload(); 387 worker_->ResumeAfterDownload();
388 else if (pause_mode_ == PAUSE_THEN_STOP) 388 else if (pause_mode_ == PAUSE_THEN_STOP)
389 worker_->Stop(); 389 worker_->Stop();
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 RunOnIOThread( 941 RunOnIOThread(
942 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, 942 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO,
943 this, 943 this,
944 embedded_test_server()->GetURL("/service_worker/empty.html"), 944 embedded_test_server()->GetURL("/service_worker/empty.html"),
945 &status)); 945 &status));
946 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); 946 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status);
947 } 947 }
948 } 948 }
949 949
950 } // namespace content 950 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_instance.cc ('k') | content/browser/service_worker/service_worker_version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698