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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const GURL kDocUrl(url); | 89 const GURL kDocUrl(url); |
90 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( | 90 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( |
91 kDocUrl, net::DEFAULT_PRIORITY, &url_request_delegate_); | 91 kDocUrl, net::DEFAULT_PRIORITY, &url_request_delegate_); |
92 request->set_method(method); | 92 request->set_method(method); |
93 ServiceWorkerRequestHandler::InitializeHandler( | 93 ServiceWorkerRequestHandler::InitializeHandler( |
94 request.get(), context_wrapper(), &blob_storage_context_, | 94 request.get(), context_wrapper(), &blob_storage_context_, |
95 kMockRenderProcessId, kMockProviderId, skip_service_worker, | 95 kMockRenderProcessId, kMockProviderId, skip_service_worker, |
96 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT, | 96 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT, |
97 FetchRedirectMode::FOLLOW_MODE, resource_type, | 97 FetchRedirectMode::FOLLOW_MODE, resource_type, |
98 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, | 98 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, |
99 nullptr); | 99 nullptr, nullptr); |
100 return ServiceWorkerRequestHandler::GetHandler(request.get()) != nullptr; | 100 return ServiceWorkerRequestHandler::GetHandler(request.get()) != nullptr; |
101 } | 101 } |
102 | 102 |
103 protected: | 103 protected: |
104 TestBrowserThreadBundle browser_thread_bundle_; | 104 TestBrowserThreadBundle browser_thread_bundle_; |
105 scoped_ptr<EmbeddedWorkerTestHelper> helper_; | 105 scoped_ptr<EmbeddedWorkerTestHelper> helper_; |
106 scoped_refptr<ServiceWorkerRegistration> registration_; | 106 scoped_refptr<ServiceWorkerRegistration> registration_; |
107 scoped_refptr<ServiceWorkerVersion> version_; | 107 scoped_refptr<ServiceWorkerVersion> version_; |
108 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; | 108 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
109 net::URLRequestContext url_request_context_; | 109 net::URLRequestContext url_request_context_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 provider_host_->SetDocumentUrl(GURL("")); | 152 provider_host_->SetDocumentUrl(GURL("")); |
153 EXPECT_FALSE(InitializeHandlerCheck( | 153 EXPECT_FALSE(InitializeHandlerCheck( |
154 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 154 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); |
155 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); | 155 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); |
156 EXPECT_FALSE(InitializeHandlerCheck( | 156 EXPECT_FALSE(InitializeHandlerCheck( |
157 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); | 157 "https://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 } | 159 } |
160 | 160 |
161 } // namespace content | 161 } // namespace content |
OLD | NEW |