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/loader/mime_type_resource_handler.h" | 5 #include "content/browser/loader/mime_type_resource_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 explicit TestResourceDispatcherHost(bool stream_has_handler) | 84 explicit TestResourceDispatcherHost(bool stream_has_handler) |
85 : stream_has_handler_(stream_has_handler), | 85 : stream_has_handler_(stream_has_handler), |
86 intercepted_as_stream_(false), | 86 intercepted_as_stream_(false), |
87 intercepted_as_stream_count_(0) {} | 87 intercepted_as_stream_count_(0) {} |
88 | 88 |
89 bool intercepted_as_stream() const { return intercepted_as_stream_; } | 89 bool intercepted_as_stream() const { return intercepted_as_stream_; } |
90 | 90 |
91 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 91 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
92 net::URLRequest* request, | 92 net::URLRequest* request, |
93 bool is_content_initiated, | 93 bool is_content_initiated, |
94 bool must_download, | 94 bool must_download) override { |
95 uint32_t id, | |
96 scoped_ptr<DownloadSaveInfo> save_info, | |
97 const DownloadUrlParameters::OnStartedCallback& started_cb) override { | |
98 return scoped_ptr<ResourceHandler>(new TestResourceHandler); | 95 return scoped_ptr<ResourceHandler>(new TestResourceHandler); |
99 } | 96 } |
100 | 97 |
101 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( | 98 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( |
102 const base::FilePath& plugin_path, | 99 const base::FilePath& plugin_path, |
103 net::URLRequest* request, | 100 net::URLRequest* request, |
104 ResourceResponse* response, | 101 ResourceResponse* response, |
105 std::string* payload) override { | 102 std::string* payload) override { |
106 intercepted_as_stream_count_++; | 103 intercepted_as_stream_count_++; |
107 if (stream_has_handler_) { | 104 if (stream_has_handler_) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 must_download = false; | 365 must_download = false; |
369 resource_type = RESOURCE_TYPE_OBJECT; | 366 resource_type = RESOURCE_TYPE_OBJECT; |
370 EXPECT_TRUE( | 367 EXPECT_TRUE( |
371 TestStreamIsIntercepted(allow_download, must_download, resource_type)); | 368 TestStreamIsIntercepted(allow_download, must_download, resource_type)); |
372 } | 369 } |
373 #endif | 370 #endif |
374 | 371 |
375 } // namespace | 372 } // namespace |
376 | 373 |
377 } // namespace content | 374 } // namespace content |
OLD | NEW |