Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: components/certificate_transparency/log_proof_fetcher_unittest.cc

Issue 1414983002: Make URLRequestTestJob accept \n terminated header lines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments mmenke Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698