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

Unified Diff: content/browser/service_worker/service_worker_registration_unittest.cc

Issue 461233004: Fix crash in ServiceWorkerRegistrationHandle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add DCHECK Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_registration_handle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_registration_unittest.cc
diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc
index 48c9393757124571f122d4fcf9a320e9b33a3d7a..67746bb55aa97c667f783bd210edcf1b7f21d354 100644
--- a/content/browser/service_worker/service_worker_registration_unittest.cc
+++ b/content/browser/service_worker/service_worker_registration_unittest.cc
@@ -10,6 +10,7 @@
#include "base/run_loop.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/service_worker/service_worker_context_core.h"
+#include "content/browser/service_worker/service_worker_registration_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -146,4 +147,24 @@ TEST_F(ServiceWorkerRegistrationTest, SetAndUnsetVersions) {
EXPECT_TRUE(listener.observed_info_.controlling_version.is_null);
}
+TEST_F(ServiceWorkerRegistrationTest, FailedRegistrationNoCrash) {
+ const GURL kScope("http://www.example.not/");
+ const GURL kScript("http://www.example.not/service_worker.js");
+ int64 kRegistrationId = 1L;
+ int kProviderId = 1;
+ scoped_refptr<ServiceWorkerRegistration> registration =
+ new ServiceWorkerRegistration(
+ kScope,
+ kScript,
+ kRegistrationId,
+ context_ptr_);
+ scoped_ptr<ServiceWorkerRegistrationHandle> handle(
+ new ServiceWorkerRegistrationHandle(context_ptr_,
+ NULL,
+ kProviderId,
+ registration.get()));
+ registration->NotifyRegistrationFailed();
+ // Don't crash when handle gets destructed.
+}
+
} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_registration_handle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698