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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 bool InitializeHandlerCheck(const std::string& url, | 78 bool InitializeHandlerCheck(const std::string& url, |
79 const std::string& method, | 79 const std::string& method, |
80 bool skip_service_worker, | 80 bool skip_service_worker, |
81 ResourceType resource_type) { | 81 ResourceType resource_type) { |
82 const GURL kDocUrl(url); | 82 const GURL kDocUrl(url); |
83 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( | 83 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( |
84 kDocUrl, net::DEFAULT_PRIORITY, &url_request_delegate_, NULL); | 84 kDocUrl, net::DEFAULT_PRIORITY, &url_request_delegate_, NULL); |
85 request->set_method(method); | 85 request->set_method(method); |
| 86 FetchRequestMode request_mode = FETCH_REQUEST_MODE_NO_CORS; |
86 ServiceWorkerRequestHandler::InitializeHandler(request.get(), | 87 ServiceWorkerRequestHandler::InitializeHandler(request.get(), |
87 context_wrapper(), | 88 context_wrapper(), |
88 &blob_storage_context_, | 89 &blob_storage_context_, |
89 kMockRenderProcessId, | 90 kMockRenderProcessId, |
90 kMockProviderId, | 91 kMockProviderId, |
91 skip_service_worker, | 92 skip_service_worker, |
| 93 request_mode, |
92 resource_type, | 94 resource_type, |
93 NULL); | 95 NULL); |
94 return ServiceWorkerRequestHandler::GetHandler(request.get()) != NULL; | 96 return ServiceWorkerRequestHandler::GetHandler(request.get()) != NULL; |
95 } | 97 } |
96 | 98 |
97 protected: | 99 protected: |
98 TestBrowserThreadBundle browser_thread_bundle_; | 100 TestBrowserThreadBundle browser_thread_bundle_; |
99 scoped_ptr<EmbeddedWorkerTestHelper> helper_; | 101 scoped_ptr<EmbeddedWorkerTestHelper> helper_; |
100 scoped_refptr<ServiceWorkerRegistration> registration_; | 102 scoped_refptr<ServiceWorkerRegistration> registration_; |
101 scoped_refptr<ServiceWorkerVersion> version_; | 103 scoped_refptr<ServiceWorkerVersion> version_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 provider_host_->SetDocumentUrl(GURL("")); | 143 provider_host_->SetDocumentUrl(GURL("")); |
142 EXPECT_FALSE(InitializeHandlerCheck( | 144 EXPECT_FALSE(InitializeHandlerCheck( |
143 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 145 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
144 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 146 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
145 EXPECT_FALSE(InitializeHandlerCheck( | 147 EXPECT_FALSE(InitializeHandlerCheck( |
146 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 148 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
147 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 149 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
148 } | 150 } |
149 | 151 |
150 } // namespace content | 152 } // namespace content |
OLD | NEW |