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 "net/quic/quic_session_key.h" | 5 #include "net/quic/quic_session_key.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 using std::string; | 9 using std::string; |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 TEST(QuicSessionKeyTest, ToString) { | 15 TEST(QuicSessionKeyTest, ToString) { |
16 HostPortPair google_host_port_pair("google.com", 10); | 16 HostPortPair google_host_port_pair("google.com", 10); |
17 | 17 |
18 QuicSessionKey google_http_key(google_host_port_pair, false, | 18 QuicSessionKey google_http_key(google_host_port_pair, false); |
19 kPrivacyModeDisabled); | |
20 string google_http_key_str = google_http_key.ToString(); | 19 string google_http_key_str = google_http_key.ToString(); |
21 EXPECT_EQ("http://google.com:10", google_http_key_str); | 20 EXPECT_EQ("http://google.com:10", google_http_key_str); |
22 | 21 |
23 QuicSessionKey google_https_key(google_host_port_pair, true, | 22 QuicSessionKey google_https_key(google_host_port_pair, true); |
24 kPrivacyModeDisabled); | |
25 string google_https_key_str = google_https_key.ToString(); | 23 string google_https_key_str = google_https_key.ToString(); |
26 EXPECT_EQ("https://google.com:10", google_https_key_str); | 24 EXPECT_EQ("https://google.com:10", google_https_key_str); |
27 | |
28 QuicSessionKey private_http_key(google_host_port_pair, false, | |
29 kPrivacyModeEnabled); | |
30 string private_http_key_str = private_http_key.ToString(); | |
31 EXPECT_EQ("http://google.com:10/private", private_http_key_str); | |
32 | |
33 QuicSessionKey private_https_key(google_host_port_pair, true, | |
34 kPrivacyModeEnabled); | |
35 string private_https_key_str = private_https_key.ToString(); | |
36 EXPECT_EQ("https://google.com:10/private", private_https_key_str); | |
37 } | 25 } |
38 | 26 |
39 } // namespace | 27 } // namespace |
40 | 28 |
41 } // namespace net | 29 } // namespace net |
OLD | NEW |