| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <tuple> | 6 #include <tuple> |
| 7 | 7 |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 SaveFoundRegistration(expected_status, &called, ®istration)); | 192 SaveFoundRegistration(expected_status, &called, ®istration)); |
| 193 | 193 |
| 194 EXPECT_FALSE(called); | 194 EXPECT_FALSE(called); |
| 195 base::RunLoop().RunUntilIdle(); | 195 base::RunLoop().RunUntilIdle(); |
| 196 EXPECT_TRUE(called); | 196 EXPECT_TRUE(called); |
| 197 return registration; | 197 return registration; |
| 198 } | 198 } |
| 199 | 199 |
| 200 std::unique_ptr<ServiceWorkerProviderHost> | 200 std::unique_ptr<ServiceWorkerProviderHost> |
| 201 ServiceWorkerJobTest::CreateControllee() { | 201 ServiceWorkerJobTest::CreateControllee() { |
| 202 return std::unique_ptr<ServiceWorkerProviderHost>( | 202 std::unique_ptr<ServiceWorkerProviderHost> host = CreateProviderHostForWindow( |
| 203 new ServiceWorkerProviderHost( | 203 33 /* dummy render process id */, 1 /* dummy provider_id */, |
| 204 33 /* dummy render_process id */, | 204 true /* is_parent_frame_secure */, helper_->context()->AsWeakPtr()); |
| 205 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */, | 205 return host; |
| 206 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | |
| 207 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
| 208 helper_->context()->AsWeakPtr(), NULL)); | |
| 209 } | 206 } |
| 210 | 207 |
| 211 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { | 208 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { |
| 212 scoped_refptr<ServiceWorkerRegistration> original_registration = | 209 scoped_refptr<ServiceWorkerRegistration> original_registration = |
| 213 RunRegisterJob(GURL("http://www.example.com/"), | 210 RunRegisterJob(GURL("http://www.example.com/"), |
| 214 GURL("http://www.example.com/service_worker.js")); | 211 GURL("http://www.example.com/service_worker.js")); |
| 215 bool called; | 212 bool called; |
| 216 scoped_refptr<ServiceWorkerRegistration> registration1; | 213 scoped_refptr<ServiceWorkerRegistration> registration1; |
| 217 storage()->FindRegistrationForDocument( | 214 storage()->FindRegistrationForDocument( |
| 218 GURL("http://www.example.com/"), | 215 GURL("http://www.example.com/"), |
| (...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 // should not be promoted to ACTIVATED because failure occur | 1737 // should not be promoted to ACTIVATED because failure occur |
| 1741 // during shutdown. | 1738 // during shutdown. |
| 1742 runner->RunUntilIdle(); | 1739 runner->RunUntilIdle(); |
| 1743 base::RunLoop().RunUntilIdle(); | 1740 base::RunLoop().RunUntilIdle(); |
| 1744 EXPECT_EQ(new_version.get(), registration->active_version()); | 1741 EXPECT_EQ(new_version.get(), registration->active_version()); |
| 1745 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); | 1742 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); |
| 1746 registration->RemoveListener(update_helper); | 1743 registration->RemoveListener(update_helper); |
| 1747 } | 1744 } |
| 1748 | 1745 |
| 1749 } // namespace content | 1746 } // namespace content |
| OLD | NEW |