OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/intercepting_resource_handler.h" | 5 #include "content/browser/loader/intercepting_resource_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 bool OnReadCompleted(int bytes_read, bool* defer) override { | 97 bool OnReadCompleted(int bytes_read, bool* defer) override { |
98 EXPECT_FALSE(is_completed_); | 98 EXPECT_FALSE(is_completed_); |
99 EXPECT_LT(bytes_read, 2048); | 99 EXPECT_LT(bytes_read, 2048); |
100 bytes_read_ += bytes_read; | 100 bytes_read_ += bytes_read; |
101 return on_read_completed_result_; | 101 return on_read_completed_result_; |
102 } | 102 } |
103 | 103 |
104 void OnResponseCompleted(const net::URLRequestStatus& status, | 104 void OnResponseCompleted(const net::URLRequestStatus& status, |
105 const std::string& security_info, | |
106 bool* defer) override { | 105 bool* defer) override { |
107 EXPECT_FALSE(is_completed_); | 106 EXPECT_FALSE(is_completed_); |
108 is_completed_ = true; | 107 is_completed_ = true; |
109 *request_status_ = status; | 108 *request_status_ = status; |
110 *final_bytes_read_ = bytes_read_; | 109 *final_bytes_read_ = bytes_read_; |
111 } | 110 } |
112 | 111 |
113 void OnDataDownloaded(int bytes_downloaded) override { NOTREACHED(); } | 112 void OnDataDownloaded(int bytes_downloaded) override { NOTREACHED(); } |
114 | 113 |
115 scoped_refptr<net::IOBuffer> buffer() const { return buffer_; } | 114 scoped_refptr<net::IOBuffer> buffer() const { return buffer_; } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 | 609 |
611 // The read is replayed by the MimeSniffingResourceHandler. The new handler | 610 // The read is replayed by the MimeSniffingResourceHandler. The new handler |
612 // should tell the caller to fail. | 611 // should tell the caller to fail. |
613 EXPECT_FALSE(intercepting_handler->OnReadCompleted(sizeof(kData), &defer)); | 612 EXPECT_FALSE(intercepting_handler->OnReadCompleted(sizeof(kData), &defer)); |
614 EXPECT_FALSE(defer); | 613 EXPECT_FALSE(defer); |
615 } | 614 } |
616 | 615 |
617 } // namespace | 616 } // namespace |
618 | 617 |
619 } // namespace content | 618 } // namespace content |
OLD | NEW |