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" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/base/network_delegate.h" | 12 #include "net/base/network_delegate.h" |
13 #include "net/cert/signed_tree_head.h" | 13 #include "net/cert/signed_tree_head.h" |
14 #include "net/http/http_status_code.h" | 14 #include "net/http/http_status_code.h" |
15 #include "net/test/ct_test_util.h" | 15 #include "net/test/ct_test_util.h" |
16 #include "net/url_request/url_request_context.h" | 16 #include "net/url_request/url_request_context.h" |
17 #include "net/url_request/url_request_filter.h" | 17 #include "net/url_request/url_request_filter.h" |
18 #include "net/url_request/url_request_interceptor.h" | 18 #include "net/url_request/url_request_interceptor.h" |
19 #include "net/url_request/url_request_job.h" | 19 #include "net/url_request/url_request_job.h" |
20 #include "net/url_request/url_request_test_job.h" | 20 #include "net/url_request/url_request_test_job.h" |
21 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 namespace certificate_transparency { | 24 namespace certificate_transparency { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 const char kGetSTHHeaders[] = | 28 const char kGetSTHHeaders[] = |
29 "HTTP/1.1 200 OK\0" | 29 "HTTP/1.1 200 OK\n" |
30 "Content-Type: application/json; charset=ISO-8859-1\0"; | 30 "Content-Type: application/json; charset=ISO-8859-1\n"; |
31 | 31 |
32 const char kGetSTHNotFoundHeaders[] = | 32 const char kGetSTHNotFoundHeaders[] = |
33 "HTTP/1.1 404 Not Found\0" | 33 "HTTP/1.1 404 Not Found\n" |
34 "Content-Type: text/html; charset=iso-8859-1\0"; | 34 "Content-Type: text/html; charset=iso-8859-1\n"; |
35 | 35 |
36 const char kLogSchema[] = "https"; | 36 const char kLogSchema[] = "https"; |
37 const char kLogHost[] = "ct.log.example.com"; | 37 const char kLogHost[] = "ct.log.example.com"; |
38 const char kLogPathPrefix[] = "somelog"; | 38 const char kLogPathPrefix[] = "somelog"; |
39 const char kLogID[] = "some_id"; | 39 const char kLogID[] = "some_id"; |
40 | 40 |
41 class FetchSTHTestJob : public net::URLRequestTestJob { | 41 class FetchSTHTestJob : public net::URLRequestTestJob { |
42 public: | 42 public: |
43 FetchSTHTestJob(const std::string& get_sth_data, | 43 FetchSTHTestJob(const std::string& get_sth_data, |
44 const std::string& get_sth_headers, | 44 const std::string& get_sth_headers, |
(...skipping 253 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 |