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 "net/url_request/url_request_file_job.h" | 5 #include "net/url_request/url_request_file_job.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 URLRequestJob* MaybeInterceptResponse( | 133 URLRequestJob* MaybeInterceptResponse( |
134 URLRequest* request, | 134 URLRequest* request, |
135 NetworkDelegate* network_delegate) const override { | 135 NetworkDelegate* network_delegate) const override { |
136 return nullptr; | 136 return nullptr; |
137 } | 137 } |
138 | 138 |
139 bool IsHandledProtocol(const std::string& scheme) const override { | 139 bool IsHandledProtocol(const std::string& scheme) const override { |
140 return scheme == "file"; | 140 return scheme == "file"; |
141 } | 141 } |
142 | 142 |
143 bool IsHandledURL(const GURL& url) const override { | |
144 return IsHandledProtocol(url.scheme()); | |
145 } | |
146 | |
147 bool IsSafeRedirectTarget(const GURL& location) const override { | 143 bool IsSafeRedirectTarget(const GURL& location) const override { |
148 return false; | 144 return false; |
149 } | 145 } |
150 | 146 |
151 private: | 147 private: |
152 const base::FilePath path_; | 148 const base::FilePath path_; |
153 | 149 |
154 // These are mutable because MaybeCreateJobWithProtocolHandler is const. | 150 // These are mutable because MaybeCreateJobWithProtocolHandler is const. |
155 mutable int* open_result_; | 151 mutable int* open_result_; |
156 mutable int64_t* seek_position_; | 152 mutable int64_t* seek_position_; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 EXPECT_EQ(OK, open_result); | 426 EXPECT_EQ(OK, open_result); |
431 EXPECT_EQ(0, seek_position); | 427 EXPECT_EQ(0, seek_position); |
432 EXPECT_EQ("hello\n", observed_content); | 428 EXPECT_EQ("hello\n", observed_content); |
433 EXPECT_TRUE(done_reading); | 429 EXPECT_TRUE(done_reading); |
434 EXPECT_FALSE(delegate_.request_failed()); | 430 EXPECT_FALSE(delegate_.request_failed()); |
435 } | 431 } |
436 | 432 |
437 } // namespace | 433 } // namespace |
438 | 434 |
439 } // namespace net | 435 } // namespace net |
OLD | NEW |