| 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 "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/browser/fileapi/mock_url_request_delegate.h" | 8 #include "content/browser/fileapi/mock_url_request_delegate.h" |
| 9 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 9 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
| 10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ServiceWorkerContextWrapper* context_wrapper() const { | 83 ServiceWorkerContextWrapper* context_wrapper() const { |
| 84 return helper_->context_wrapper(); | 84 return helper_->context_wrapper(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool InitializeHandlerCheck(const std::string& url, | 87 bool InitializeHandlerCheck(const std::string& url, |
| 88 const std::string& method, | 88 const std::string& method, |
| 89 bool skip_service_worker, | 89 bool skip_service_worker, |
| 90 ResourceType resource_type) { | 90 ResourceType resource_type) { |
| 91 const GURL kDocUrl(url); | 91 const GURL kDocUrl(url); |
| 92 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( | 92 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( |
| 93 kDocUrl, net::DEFAULT_PRIORITY, &url_request_delegate_, nullptr); | 93 kDocUrl, net::DEFAULT_PRIORITY, &url_request_delegate_); |
| 94 request->set_method(method); | 94 request->set_method(method); |
| 95 ServiceWorkerRequestHandler::InitializeHandler( | 95 ServiceWorkerRequestHandler::InitializeHandler( |
| 96 request.get(), | 96 request.get(), |
| 97 context_wrapper(), | 97 context_wrapper(), |
| 98 &blob_storage_context_, | 98 &blob_storage_context_, |
| 99 kMockRenderProcessId, | 99 kMockRenderProcessId, |
| 100 kMockProviderId, | 100 kMockProviderId, |
| 101 skip_service_worker, | 101 skip_service_worker, |
| 102 FETCH_REQUEST_MODE_NO_CORS, | 102 FETCH_REQUEST_MODE_NO_CORS, |
| 103 FETCH_CREDENTIALS_MODE_OMIT, | 103 FETCH_CREDENTIALS_MODE_OMIT, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 provider_host_->SetDocumentUrl(GURL("")); | 155 provider_host_->SetDocumentUrl(GURL("")); |
| 156 EXPECT_FALSE(InitializeHandlerCheck( | 156 EXPECT_FALSE(InitializeHandlerCheck( |
| 157 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 157 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
| 158 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 158 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
| 159 EXPECT_FALSE(InitializeHandlerCheck( | 159 EXPECT_FALSE(InitializeHandlerCheck( |
| 160 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 160 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
| 161 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 161 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace content | 164 } // namespace content |
| OLD | NEW |