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

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

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 months 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"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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