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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 SaveFoundRegistration(expected_status, &called, ®istration)); | 180 SaveFoundRegistration(expected_status, &called, ®istration)); |
181 | 181 |
182 EXPECT_FALSE(called); | 182 EXPECT_FALSE(called); |
183 base::RunLoop().RunUntilIdle(); | 183 base::RunLoop().RunUntilIdle(); |
184 EXPECT_TRUE(called); | 184 EXPECT_TRUE(called); |
185 return registration; | 185 return registration; |
186 } | 186 } |
187 | 187 |
188 std::unique_ptr<ServiceWorkerProviderHost> | 188 std::unique_ptr<ServiceWorkerProviderHost> |
189 ServiceWorkerJobTest::CreateControllee() { | 189 ServiceWorkerJobTest::CreateControllee() { |
190 return std::unique_ptr<ServiceWorkerProviderHost>( | 190 std::unique_ptr<ServiceWorkerProviderHost> host = CreateProviderHostForWindow( |
191 new ServiceWorkerProviderHost( | 191 33 /* dummy render process id */, 1 /* dummy provider_id */, |
192 33 /* dummy render_process id */, | 192 true /* is_parent_frame_secure */, helper_->context()->AsWeakPtr()); |
193 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */, | 193 return host; |
194 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | |
195 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
196 helper_->context()->AsWeakPtr(), NULL)); | |
197 } | 194 } |
198 | 195 |
199 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { | 196 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { |
200 scoped_refptr<ServiceWorkerRegistration> original_registration = | 197 scoped_refptr<ServiceWorkerRegistration> original_registration = |
201 RunRegisterJob(GURL("http://www.example.com/"), | 198 RunRegisterJob(GURL("http://www.example.com/"), |
202 GURL("http://www.example.com/service_worker.js")); | 199 GURL("http://www.example.com/service_worker.js")); |
203 bool called; | 200 bool called; |
204 scoped_refptr<ServiceWorkerRegistration> registration1; | 201 scoped_refptr<ServiceWorkerRegistration> registration1; |
205 storage()->FindRegistrationForDocument( | 202 storage()->FindRegistrationForDocument( |
206 GURL("http://www.example.com/"), | 203 GURL("http://www.example.com/"), |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 // should not be promoted to ACTIVATED because failure occur | 1723 // should not be promoted to ACTIVATED because failure occur |
1727 // during shutdown. | 1724 // during shutdown. |
1728 runner->RunUntilIdle(); | 1725 runner->RunUntilIdle(); |
1729 base::RunLoop().RunUntilIdle(); | 1726 base::RunLoop().RunUntilIdle(); |
1730 EXPECT_EQ(new_version.get(), registration->active_version()); | 1727 EXPECT_EQ(new_version.get(), registration->active_version()); |
1731 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); | 1728 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); |
1732 registration->RemoveListener(update_helper); | 1729 registration->RemoveListener(update_helper); |
1733 } | 1730 } |
1734 | 1731 |
1735 } // namespace content | 1732 } // namespace content |
OLD | NEW |