OLD | NEW |
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 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ
est_options.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ
est_options.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/md5.h" | 8 #include "base/md5.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (expected_header.empty()) { | 167 if (expected_header.empty()) { |
168 EXPECT_FALSE(headers.HasHeader(kChromeProxyHeader)); | 168 EXPECT_FALSE(headers.HasHeader(kChromeProxyHeader)); |
169 return; | 169 return; |
170 } | 170 } |
171 EXPECT_TRUE(headers.HasHeader(kChromeProxyHeader)); | 171 EXPECT_TRUE(headers.HasHeader(kChromeProxyHeader)); |
172 std::string header_value; | 172 std::string header_value; |
173 headers.GetHeader(kChromeProxyHeader, &header_value); | 173 headers.GetHeader(kChromeProxyHeader, &header_value); |
174 EXPECT_EQ(expected_header, header_value); | 174 EXPECT_EQ(expected_header, header_value); |
175 } | 175 } |
176 | 176 |
| 177 base::MessageLoopForIO message_loop_; |
177 scoped_ptr<TestDataReductionProxyRequestOptions> request_options_; | 178 scoped_ptr<TestDataReductionProxyRequestOptions> request_options_; |
178 scoped_ptr<DataReductionProxyTestContext> test_context_; | 179 scoped_ptr<DataReductionProxyTestContext> test_context_; |
179 }; | 180 }; |
180 | 181 |
181 TEST_F(DataReductionProxyRequestOptionsTest, AuthHashForSalt) { | 182 TEST_F(DataReductionProxyRequestOptionsTest, AuthHashForSalt) { |
182 std::string salt = "8675309"; // Jenny's number to test the hash generator. | 183 std::string salt = "8675309"; // Jenny's number to test the hash generator. |
183 std::string salted_key = salt + kDataReductionProxyKey + salt; | 184 std::string salted_key = salt + kDataReductionProxyKey + salt; |
184 base::string16 expected_hash = base::UTF8ToUTF16(base::MD5String(salted_key)); | 185 base::string16 expected_hash = base::UTF8ToUTF16(base::MD5String(salted_key)); |
185 EXPECT_EQ(expected_hash, | 186 EXPECT_EQ(expected_hash, |
186 DataReductionProxyRequestOptions::AuthHashForSalt( | 187 DataReductionProxyRequestOptions::AuthHashForSalt( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 std::string expire_time; | 377 std::string expire_time; |
377 EXPECT_TRUE(values->GetString("sessionKey", &session)); | 378 EXPECT_TRUE(values->GetString("sessionKey", &session)); |
378 EXPECT_TRUE(values->GetString("expireTime", &expire_time)); | 379 EXPECT_TRUE(values->GetString("expireTime", &expire_time)); |
379 EXPECT_EQ( | 380 EXPECT_EQ( |
380 "0-1633771873-1633771873-1633771873|96bd72ec4a050ba60981743d41787768", | 381 "0-1633771873-1633771873-1633771873|96bd72ec4a050ba60981743d41787768", |
381 session); | 382 session); |
382 EXPECT_EQ("1970-01-02T00:00:00.000Z", expire_time); | 383 EXPECT_EQ("1970-01-02T00:00:00.000Z", expire_time); |
383 } | 384 } |
384 | 385 |
385 } // namespace data_reduction_proxy | 386 } // namespace data_reduction_proxy |
OLD | NEW |