| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 version_ = new ServiceWorkerVersion(registration_.get(), | 47 version_ = new ServiceWorkerVersion(registration_.get(), |
| 48 GURL("http://host/script.js"), | 48 GURL("http://host/script.js"), |
| 49 1L, | 49 1L, |
| 50 context()->AsWeakPtr()); | 50 context()->AsWeakPtr()); |
| 51 | 51 |
| 52 // An empty host. | 52 // An empty host. |
| 53 std::unique_ptr<ServiceWorkerProviderHost> host( | 53 std::unique_ptr<ServiceWorkerProviderHost> host( |
| 54 new ServiceWorkerProviderHost(helper_->mock_render_process_id(), | 54 new ServiceWorkerProviderHost(helper_->mock_render_process_id(), |
| 55 MSG_ROUTING_NONE, kMockProviderId, | 55 MSG_ROUTING_NONE, kMockProviderId, |
| 56 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 56 SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
| 57 true /* is_parent_frame_secure */, |
| 57 context()->AsWeakPtr(), nullptr)); | 58 context()->AsWeakPtr(), nullptr)); |
| 58 host->SetDocumentUrl(GURL("http://host/scope/")); | 59 host->SetDocumentUrl(GURL("http://host/scope/")); |
| 59 provider_host_ = host->AsWeakPtr(); | 60 provider_host_ = host->AsWeakPtr(); |
| 60 context()->AddProviderHost(std::move(host)); | 61 context()->AddProviderHost(std::move(host)); |
| 61 | 62 |
| 62 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); | 63 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); |
| 63 base::RunLoop().RunUntilIdle(); | 64 base::RunLoop().RunUntilIdle(); |
| 64 | 65 |
| 65 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); | 66 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); |
| 66 registration_->SetActiveVersion(version_); | 67 registration_->SetActiveVersion(version_); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 provider_host_->SetDocumentUrl(GURL("")); | 156 provider_host_->SetDocumentUrl(GURL("")); |
| 156 EXPECT_FALSE(InitializeHandlerCheck( | 157 EXPECT_FALSE(InitializeHandlerCheck( |
| 157 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 158 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
| 158 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 159 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
| 159 EXPECT_FALSE(InitializeHandlerCheck( | 160 EXPECT_FALSE(InitializeHandlerCheck( |
| 160 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 161 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
| 161 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 162 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace content | 165 } // namespace content |
| OLD | NEW |