| 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> |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_ASYNC; | 931 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_ASYNC; |
| 932 base::File file(temp_path_, flags); | 932 base::File file(temp_path_, flags); |
| 933 CHECK(file.IsValid()); | 933 CHECK(file.IsValid()); |
| 934 | 934 |
| 935 // Create mock file streams and a ShareableFileReference. | 935 // Create mock file streams and a ShareableFileReference. |
| 936 std::unique_ptr<net::testing::MockFileStream> file_stream( | 936 std::unique_ptr<net::testing::MockFileStream> file_stream( |
| 937 new net::testing::MockFileStream(std::move(file), | 937 new net::testing::MockFileStream(std::move(file), |
| 938 base::ThreadTaskRunnerHandle::Get())); | 938 base::ThreadTaskRunnerHandle::Get())); |
| 939 file_stream_ = file_stream.get(); | 939 file_stream_ = file_stream.get(); |
| 940 deletable_file_ = ShareableFileReference::GetOrCreate( | 940 deletable_file_ = ShareableFileReference::GetOrCreate( |
| 941 temp_path_, | 941 temp_path_, ShareableFileReference::DELETE_ON_FINAL_RELEASE, |
| 942 ShareableFileReference::DELETE_ON_FINAL_RELEASE, | 942 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); |
| 943 BrowserThread::GetMessageLoopProxyForThread( | |
| 944 BrowserThread::FILE).get()); | |
| 945 | 943 |
| 946 // Inject them into the handler. | 944 // Inject them into the handler. |
| 947 std::unique_ptr<RedirectToFileResourceHandler> handler( | 945 std::unique_ptr<RedirectToFileResourceHandler> handler( |
| 948 new RedirectToFileResourceHandler(std::move(leaf_handler), request)); | 946 new RedirectToFileResourceHandler(std::move(leaf_handler), request)); |
| 949 redirect_to_file_resource_handler_ = handler.get(); | 947 redirect_to_file_resource_handler_ = handler.get(); |
| 950 handler->SetCreateTemporaryFileStreamFunctionForTesting( | 948 handler->SetCreateTemporaryFileStreamFunctionForTesting( |
| 951 base::Bind(&ResourceLoaderRedirectToFileTest::PostCallback, | 949 base::Bind(&ResourceLoaderRedirectToFileTest::PostCallback, |
| 952 base::Unretained(this), | 950 base::Unretained(this), |
| 953 base::Passed(&file_stream))); | 951 base::Passed(&file_stream))); |
| 954 return std::move(handler); | 952 return std::move(handler); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 | 1232 |
| 1235 // Tests that the effective connection type is not set on non-main frame | 1233 // Tests that the effective connection type is not set on non-main frame |
| 1236 // requests. | 1234 // requests. |
| 1237 TEST_F(EffectiveConnectionTypeResourceLoaderTest, NotAMainFrame) { | 1235 TEST_F(EffectiveConnectionTypeResourceLoaderTest, NotAMainFrame) { |
| 1238 VerifyEffectiveConnectionType( | 1236 VerifyEffectiveConnectionType( |
| 1239 false, net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_3G, | 1237 false, net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_3G, |
| 1240 net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); | 1238 net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); |
| 1241 } | 1239 } |
| 1242 | 1240 |
| 1243 } // namespace content | 1241 } // namespace content |
| OLD | NEW |