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/browser/service_worker/service_worker_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 EXPECT_EQ(version_1_id, listener.observed_info_.active_version.version_id); | 158 EXPECT_EQ(version_1_id, listener.observed_info_.active_version.version_id); |
159 EXPECT_EQ(listener.observed_info_.waiting_version.version_id, | 159 EXPECT_EQ(listener.observed_info_.waiting_version.version_id, |
160 kInvalidServiceWorkerVersionId); | 160 kInvalidServiceWorkerVersionId); |
161 EXPECT_EQ(listener.observed_info_.installing_version.version_id, | 161 EXPECT_EQ(listener.observed_info_.installing_version.version_id, |
162 kInvalidServiceWorkerVersionId); | 162 kInvalidServiceWorkerVersionId); |
163 } | 163 } |
164 | 164 |
165 TEST_F(ServiceWorkerRegistrationTest, FailedRegistrationNoCrash) { | 165 TEST_F(ServiceWorkerRegistrationTest, FailedRegistrationNoCrash) { |
166 const GURL kScope("http://www.example.not/"); | 166 const GURL kScope("http://www.example.not/"); |
167 int64 kRegistrationId = 1L; | 167 int64 kRegistrationId = 1L; |
168 int kProviderId = 1; | |
169 scoped_refptr<ServiceWorkerRegistration> registration = | 168 scoped_refptr<ServiceWorkerRegistration> registration = |
170 new ServiceWorkerRegistration( | 169 new ServiceWorkerRegistration( |
171 kScope, | 170 kScope, |
172 kRegistrationId, | 171 kRegistrationId, |
173 context_ptr_); | 172 context_ptr_); |
174 scoped_ptr<ServiceWorkerRegistrationHandle> handle( | 173 scoped_ptr<ServiceWorkerRegistrationHandle> handle( |
175 new ServiceWorkerRegistrationHandle(context_ptr_, | 174 new ServiceWorkerRegistrationHandle( |
176 NULL, | 175 context_ptr_, |
177 kProviderId, | 176 base::WeakPtr<ServiceWorkerProviderHost>(), |
178 registration.get())); | 177 registration.get())); |
179 registration->NotifyRegistrationFailed(); | 178 registration->NotifyRegistrationFailed(); |
180 // Don't crash when handle gets destructed. | 179 // Don't crash when handle gets destructed. |
181 } | 180 } |
182 | 181 |
183 } // namespace content | 182 } // namespace content |
OLD | NEW |