OLD | NEW |
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/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/browser/service_worker/embedded_worker_registry.h" | 9 #include "content/browser/service_worker/embedded_worker_registry.h" |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 SaveFoundRegistration(expected_status, &called, ®istration)); | 174 SaveFoundRegistration(expected_status, &called, ®istration)); |
175 | 175 |
176 EXPECT_FALSE(called); | 176 EXPECT_FALSE(called); |
177 base::RunLoop().RunUntilIdle(); | 177 base::RunLoop().RunUntilIdle(); |
178 EXPECT_TRUE(called); | 178 EXPECT_TRUE(called); |
179 return registration; | 179 return registration; |
180 } | 180 } |
181 | 181 |
182 scoped_ptr<ServiceWorkerProviderHost> ServiceWorkerJobTest::CreateControllee() { | 182 scoped_ptr<ServiceWorkerProviderHost> ServiceWorkerJobTest::CreateControllee() { |
183 return scoped_ptr<ServiceWorkerProviderHost>(new ServiceWorkerProviderHost( | 183 return scoped_ptr<ServiceWorkerProviderHost>(new ServiceWorkerProviderHost( |
184 33 /* dummy render_process id */, MSG_ROUTING_NONE /* render_frame_id */, | 184 33 /* dummy render_process id */, 1 /* dummy render_frame_id */, |
185 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 185 MSG_ROUTING_NONE /* shared_worker_route_id */, 1 /* dummy provider_id */, |
186 helper_->context()->AsWeakPtr(), NULL)); | 186 helper_->context()->AsWeakPtr(), NULL)); |
187 } | 187 } |
188 | 188 |
189 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { | 189 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { |
190 scoped_refptr<ServiceWorkerRegistration> original_registration = | 190 scoped_refptr<ServiceWorkerRegistration> original_registration = |
191 RunRegisterJob(GURL("http://www.example.com/"), | 191 RunRegisterJob(GURL("http://www.example.com/"), |
192 GURL("http://www.example.com/service_worker.js")); | 192 GURL("http://www.example.com/service_worker.js")); |
193 bool called; | 193 bool called; |
194 scoped_refptr<ServiceWorkerRegistration> registration1; | 194 scoped_refptr<ServiceWorkerRegistration> registration1; |
195 storage()->FindRegistrationForDocument( | 195 storage()->FindRegistrationForDocument( |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 EXPECT_FALSE(registration->is_uninstalling()); | 1462 EXPECT_FALSE(registration->is_uninstalling()); |
1463 EXPECT_FALSE(registration->is_uninstalled()); | 1463 EXPECT_FALSE(registration->is_uninstalled()); |
1464 | 1464 |
1465 EXPECT_EQ(ServiceWorkerVersion::STOPPED, old_version->running_status()); | 1465 EXPECT_EQ(ServiceWorkerVersion::STOPPED, old_version->running_status()); |
1466 EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, old_version->status()); | 1466 EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, old_version->status()); |
1467 | 1467 |
1468 FindRegistrationForPattern(pattern, SERVICE_WORKER_OK); | 1468 FindRegistrationForPattern(pattern, SERVICE_WORKER_OK); |
1469 } | 1469 } |
1470 | 1470 |
1471 } // namespace content | 1471 } // namespace content |
OLD | NEW |