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

Side by Side Diff: chrome/browser/net/sdch_browsertest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // End-to-end SDCH tests. Uses the embedded test server to return SDCH 5 // End-to-end SDCH tests. Uses the embedded test server to return SDCH
6 // results 6 // results
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 std::replace(output->begin(), output->end(), '+', '-'); 124 std::replace(output->begin(), output->end(), '+', '-');
125 std::replace(output->begin(), output->end(), '/', '_'); 125 std::replace(output->begin(), output->end(), '/', '_');
126 } 126 }
127 127
128 // Class that bundles responses for an EmbeddedTestServer(). 128 // Class that bundles responses for an EmbeddedTestServer().
129 // Dictionary is at <domain>/dict, data at <domain>/data. 129 // Dictionary is at <domain>/dict, data at <domain>/data.
130 // The data is sent SDCH encoded if that's allowed by protoocol. 130 // The data is sent SDCH encoded if that's allowed by protoocol.
131 class SdchResponseHandler { 131 class SdchResponseHandler {
132 public: 132 public:
133 // Do initial preparation so that SDCH requests can be handled. 133 // Do initial preparation so that SDCH requests can be handled.
134 explicit SdchResponseHandler(std::string domain) 134 explicit SdchResponseHandler(const std::string& domain)
135 : cache_sdch_response_(false), 135 : cache_sdch_response_(false), weak_ptr_factory_(this) {
136 weak_ptr_factory_(this) {
137 // Dictionary 136 // Dictionary
138 sdch_dictionary_contents_ = "Domain: "; 137 sdch_dictionary_contents_ = "Domain: ";
139 sdch_dictionary_contents_ += domain; 138 sdch_dictionary_contents_ += domain;
140 sdch_dictionary_contents_ += "\n\n"; 139 sdch_dictionary_contents_ += "\n\n";
141 sdch_dictionary_contents_ += kDictionaryContents; 140 sdch_dictionary_contents_ += kDictionaryContents;
142 141
143 // Dictionary hash for client and server. 142 // Dictionary hash for client and server.
144 char binary_hash[32]; 143 char binary_hash[32];
145 crypto::SHA256HashString(sdch_dictionary_contents_, binary_hash, 144 crypto::SHA256HashString(sdch_dictionary_contents_, binary_hash,
146 sizeof(binary_hash)); 145 sizeof(binary_hash));
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 ASSERT_TRUE(SetupIncognitoBrowser()); 706 ASSERT_TRUE(SetupIncognitoBrowser());
708 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); 707 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser()));
709 708
710 // Data fetches on main browser should not be SDCH encoded. 709 // Data fetches on main browser should not be SDCH encoded.
711 bool sdch_encoding_used = true; 710 bool sdch_encoding_used = true;
712 ASSERT_TRUE(GetData(&sdch_encoding_used)); 711 ASSERT_TRUE(GetData(&sdch_encoding_used));
713 EXPECT_FALSE(sdch_encoding_used); 712 EXPECT_FALSE(sdch_encoding_used);
714 } 713 }
715 714
716 } // namespace 715 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698