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 = |
191 new ServiceWorkerProviderHost( | 191 ServiceWorkerProviderHost::CreateForTesting( |
192 33 /* dummy render_process id */, | 192 33 /* dummy render process id */, 1 /* dummy provider_id */, |
193 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */, | 193 SERVICE_WORKER_PROVIDER_FOR_WINDOW, helper_->context()->AsWeakPtr()); |
194 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 194 host->set_parent_frame_secure(true); |
195 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | 195 return host; |
196 helper_->context()->AsWeakPtr(), NULL)); | |
197 } | 196 } |
198 | 197 |
199 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { | 198 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { |
200 scoped_refptr<ServiceWorkerRegistration> original_registration = | 199 scoped_refptr<ServiceWorkerRegistration> original_registration = |
201 RunRegisterJob(GURL("http://www.example.com/"), | 200 RunRegisterJob(GURL("http://www.example.com/"), |
202 GURL("http://www.example.com/service_worker.js")); | 201 GURL("http://www.example.com/service_worker.js")); |
203 bool called; | 202 bool called; |
204 scoped_refptr<ServiceWorkerRegistration> registration1; | 203 scoped_refptr<ServiceWorkerRegistration> registration1; |
205 storage()->FindRegistrationForDocument( | 204 storage()->FindRegistrationForDocument( |
206 GURL("http://www.example.com/"), | 205 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 | 1725 // should not be promoted to ACTIVATED because failure occur |
1727 // during shutdown. | 1726 // during shutdown. |
1728 runner->RunUntilIdle(); | 1727 runner->RunUntilIdle(); |
1729 base::RunLoop().RunUntilIdle(); | 1728 base::RunLoop().RunUntilIdle(); |
1730 EXPECT_EQ(new_version.get(), registration->active_version()); | 1729 EXPECT_EQ(new_version.get(), registration->active_version()); |
1731 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); | 1730 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); |
1732 registration->RemoveListener(update_helper); | 1731 registration->RemoveListener(update_helper); |
1733 } | 1732 } |
1734 | 1733 |
1735 } // namespace content | 1734 } // namespace content |
OLD | NEW |