OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/certificate_transparency/log_proof_fetcher.h" | 5 #include "components/certificate_transparency/log_proof_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "components/safe_json/testing_json_parser.h" | 10 #include "components/safe_json/testing_json_parser.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 net::NetworkDelegate* network_delegate) const override { | 91 net::NetworkDelegate* network_delegate) const override { |
92 std::string expected_url = base::StringPrintf( | 92 std::string expected_url = base::StringPrintf( |
93 "%s://%s/%s/ct/v1/get-sth", kLogSchema, kLogHost, kLogPathPrefix); | 93 "%s://%s/%s/ct/v1/get-sth", kLogSchema, kLogHost, kLogPathPrefix); |
94 EXPECT_EQ(GURL(expected_url), request->url()); | 94 EXPECT_EQ(GURL(expected_url), request->url()); |
95 FetchSTHTestJob* job = new FetchSTHTestJob( | 95 FetchSTHTestJob* job = new FetchSTHTestJob( |
96 response_body_, response_headers_, request, network_delegate); | 96 response_body_, response_headers_, request, network_delegate); |
97 job->set_async_io(async_io_); | 97 job->set_async_io(async_io_); |
98 return job; | 98 return job; |
99 } | 99 } |
100 | 100 |
101 void set_response_body(std::string response_body) { | 101 void set_response_body(const std::string& response_body) { |
102 response_body_ = response_body; | 102 response_body_ = response_body; |
103 } | 103 } |
104 | 104 |
105 void set_response_headers(std::string response_headers) { | 105 void set_response_headers(const std::string& response_headers) { |
106 response_headers_ = response_headers; | 106 response_headers_ = response_headers; |
107 } | 107 } |
108 | 108 |
109 void set_async_io(bool async_io) { async_io_ = async_io; } | 109 void set_async_io(bool async_io) { async_io_ = async_io; } |
110 | 110 |
111 private: | 111 private: |
112 bool async_io_; | 112 bool async_io_; |
113 std::string response_body_; | 113 std::string response_body_; |
114 std::string response_headers_; | 114 std::string response_headers_; |
115 | 115 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 RunFetcherWithCallback(&callback); | 298 RunFetcherWithCallback(&callback); |
299 | 299 |
300 ASSERT_TRUE(callback.invoked()); | 300 ASSERT_TRUE(callback.invoked()); |
301 EXPECT_EQ(net::OK, callback.net_error()); | 301 EXPECT_EQ(net::OK, callback.net_error()); |
302 EXPECT_EQ(net::HTTP_NOT_FOUND, callback.http_response_code()); | 302 EXPECT_EQ(net::HTTP_NOT_FOUND, callback.http_response_code()); |
303 } | 303 } |
304 | 304 |
305 } // namespace | 305 } // namespace |
306 | 306 |
307 } // namespace certificate_transparency | 307 } // namespace certificate_transparency |
OLD | NEW |