| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "content/browser/browser_thread_impl.h" | 22 #include "content/browser/browser_thread_impl.h" |
| 23 #include "content/browser/loader/redirect_to_file_resource_handler.h" | 23 #include "content/browser/loader/redirect_to_file_resource_handler.h" |
| 24 #include "content/browser/loader/resource_loader_delegate.h" | 24 #include "content/browser/loader/resource_loader_delegate.h" |
| 25 #include "content/public/browser/cert_store.h" | |
| 26 #include "content/public/browser/client_certificate_delegate.h" | 25 #include "content/public/browser/client_certificate_delegate.h" |
| 27 #include "content/public/browser/resource_request_info.h" | 26 #include "content/public/browser/resource_request_info.h" |
| 28 #include "content/public/common/content_paths.h" | 27 #include "content/public/common/content_paths.h" |
| 29 #include "content/public/common/resource_response.h" | 28 #include "content/public/common/resource_response.h" |
| 30 #include "content/public/common/resource_type.h" | 29 #include "content/public/common/resource_type.h" |
| 31 #include "content/public/test/mock_resource_context.h" | 30 #include "content/public/test/mock_resource_context.h" |
| 32 #include "content/public/test/test_browser_context.h" | 31 #include "content/public/test/test_browser_context.h" |
| 33 #include "content/public/test/test_browser_thread_bundle.h" | 32 #include "content/public/test/test_browser_thread_bundle.h" |
| 34 #include "content/public/test/test_renderer_host.h" | 33 #include "content/public/test/test_renderer_host.h" |
| 35 #include "content/test/test_content_browser_client.h" | 34 #include "content/test/test_content_browser_client.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 rfh->GetProcess()->GetID(), rfh->GetRenderViewHost()->GetRoutingID(), | 603 rfh->GetProcess()->GetID(), rfh->GetRenderViewHost()->GetRoutingID(), |
| 605 rfh->GetRoutingID(), belongs_to_main_frame, | 604 rfh->GetRoutingID(), belongs_to_main_frame, |
| 606 false /* parent_is_main_frame */, true /* allow_download */, | 605 false /* parent_is_main_frame */, true /* allow_download */, |
| 607 false /* is_async */, false /* is_using_lofi_ */); | 606 false /* is_async */, false /* is_using_lofi_ */); |
| 608 std::unique_ptr<ResourceHandlerStub> resource_handler( | 607 std::unique_ptr<ResourceHandlerStub> resource_handler( |
| 609 new ResourceHandlerStub(request.get())); | 608 new ResourceHandlerStub(request.get())); |
| 610 raw_ptr_resource_handler_ = resource_handler.get(); | 609 raw_ptr_resource_handler_ = resource_handler.get(); |
| 611 loader_.reset(new ResourceLoader( | 610 loader_.reset(new ResourceLoader( |
| 612 std::move(request), | 611 std::move(request), |
| 613 WrapResourceHandler(std::move(resource_handler), raw_ptr_to_request_), | 612 WrapResourceHandler(std::move(resource_handler), raw_ptr_to_request_), |
| 614 CertStore::GetInstance(), this)); | 613 this)); |
| 615 } | 614 } |
| 616 | 615 |
| 617 void SetUp() override { | 616 void SetUp() override { |
| 618 job_factory_.SetProtocolHandler("test", CreateProtocolHandler()); | 617 job_factory_.SetProtocolHandler("test", CreateProtocolHandler()); |
| 619 | 618 |
| 620 browser_context_.reset(new TestBrowserContext()); | 619 browser_context_.reset(new TestBrowserContext()); |
| 621 scoped_refptr<SiteInstance> site_instance = | 620 scoped_refptr<SiteInstance> site_instance = |
| 622 SiteInstance::Create(browser_context_.get()); | 621 SiteInstance::Create(browser_context_.get()); |
| 623 web_contents_.reset( | 622 web_contents_.reset( |
| 624 TestWebContents::Create(browser_context_.get(), site_instance.get())); | 623 TestWebContents::Create(browser_context_.get(), site_instance.get())); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 | 1159 |
| 1161 // Tests that the effective connection type is not set on non-main frame | 1160 // Tests that the effective connection type is not set on non-main frame |
| 1162 // requests. | 1161 // requests. |
| 1163 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { | 1162 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { |
| 1164 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, | 1163 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, |
| 1165 net::EFFECTIVE_CONNECTION_TYPE_3G, | 1164 net::EFFECTIVE_CONNECTION_TYPE_3G, |
| 1166 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); | 1165 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); |
| 1167 } | 1166 } |
| 1168 | 1167 |
| 1169 } // namespace content | 1168 } // namespace content |
| OLD | NEW |