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 "content/browser/service_worker/service_worker_request_handler.h" | 5 #include "content/browser/service_worker/service_worker_request_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/fileapi/mock_url_request_delegate.h" | 10 #include "content/browser/fileapi/mock_url_request_delegate.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 55 kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
56 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | 56 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, |
57 context()->AsWeakPtr(), nullptr)); | 57 context()->AsWeakPtr(), nullptr)); |
58 host->SetDocumentUrl(GURL("https://host/scope/")); | 58 host->SetDocumentUrl(GURL("https://host/scope/")); |
59 provider_host_ = host->AsWeakPtr(); | 59 provider_host_ = host->AsWeakPtr(); |
60 context()->AddProviderHost(std::move(host)); | 60 context()->AddProviderHost(std::move(host)); |
61 | 61 |
62 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); | 62 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); |
63 base::RunLoop().RunUntilIdle(); | 63 base::RunLoop().RunUntilIdle(); |
64 | 64 |
| 65 version_->set_fetch_handler_existence( |
| 66 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); |
65 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); | 67 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); |
66 registration_->SetActiveVersion(version_); | 68 registration_->SetActiveVersion(version_); |
67 context()->storage()->StoreRegistration( | 69 context()->storage()->StoreRegistration( |
68 registration_.get(), | 70 registration_.get(), |
69 version_.get(), | 71 version_.get(), |
70 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 72 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
71 provider_host_->AssociateRegistration(registration_.get(), | 73 provider_host_->AssociateRegistration(registration_.get(), |
72 false /* notify_controllerchange */); | 74 false /* notify_controllerchange */); |
73 base::RunLoop().RunUntilIdle(); | 75 base::RunLoop().RunUntilIdle(); |
74 } | 76 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 provider_host_->SetDocumentUrl(GURL("")); | 157 provider_host_->SetDocumentUrl(GURL("")); |
156 EXPECT_FALSE(InitializeHandlerCheck( | 158 EXPECT_FALSE(InitializeHandlerCheck( |
157 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 159 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
158 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 160 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
159 EXPECT_FALSE(InitializeHandlerCheck( | 161 EXPECT_FALSE(InitializeHandlerCheck( |
160 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 162 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
161 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 163 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
162 } | 164 } |
163 | 165 |
164 } // namespace content | 166 } // namespace content |
OLD | NEW |