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

Side by Side Diff: net/quic/core/quic_server_id_test.cc

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 7 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 #include "net/quic/core/quic_server_id.h" 5 #include "net/quic/core/quic_server_id.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "net/quic/platform/api/quic_test.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(QuicServerIdTest, ToString) { 15 class QuicServerIdTest : public QuicTest {};
16
17 TEST_F(QuicServerIdTest, ToString) {
16 HostPortPair google_host_port_pair("google.com", 10); 18 HostPortPair google_host_port_pair("google.com", 10);
17 19
18 QuicServerId google_server_id(google_host_port_pair, PRIVACY_MODE_DISABLED); 20 QuicServerId google_server_id(google_host_port_pair, PRIVACY_MODE_DISABLED);
19 string google_server_id_str = google_server_id.ToString(); 21 string google_server_id_str = google_server_id.ToString();
20 EXPECT_EQ("https://google.com:10", google_server_id_str); 22 EXPECT_EQ("https://google.com:10", google_server_id_str);
21 23
22 QuicServerId private_server_id(google_host_port_pair, PRIVACY_MODE_ENABLED); 24 QuicServerId private_server_id(google_host_port_pair, PRIVACY_MODE_ENABLED);
23 string private_server_id_str = private_server_id.ToString(); 25 string private_server_id_str = private_server_id.ToString();
24 EXPECT_EQ("https://google.com:10/private", private_server_id_str); 26 EXPECT_EQ("https://google.com:10/private", private_server_id_str);
25 } 27 }
26 28
27 TEST(QuicServerIdTest, LessThan) { 29 TEST_F(QuicServerIdTest, LessThan) {
28 QuicServerId a_10_https(HostPortPair("a.com", 10), PRIVACY_MODE_DISABLED); 30 QuicServerId a_10_https(HostPortPair("a.com", 10), PRIVACY_MODE_DISABLED);
29 QuicServerId a_11_https(HostPortPair("a.com", 11), PRIVACY_MODE_DISABLED); 31 QuicServerId a_11_https(HostPortPair("a.com", 11), PRIVACY_MODE_DISABLED);
30 QuicServerId b_10_https(HostPortPair("b.com", 10), PRIVACY_MODE_DISABLED); 32 QuicServerId b_10_https(HostPortPair("b.com", 10), PRIVACY_MODE_DISABLED);
31 QuicServerId b_11_https(HostPortPair("b.com", 11), PRIVACY_MODE_DISABLED); 33 QuicServerId b_11_https(HostPortPair("b.com", 11), PRIVACY_MODE_DISABLED);
32 34
33 QuicServerId a_10_https_private(HostPortPair("a.com", 10), 35 QuicServerId a_10_https_private(HostPortPair("a.com", 10),
34 PRIVACY_MODE_ENABLED); 36 PRIVACY_MODE_ENABLED);
35 QuicServerId a_11_https_private(HostPortPair("a.com", 11), 37 QuicServerId a_11_https_private(HostPortPair("a.com", 11),
36 PRIVACY_MODE_ENABLED); 38 PRIVACY_MODE_ENABLED);
37 QuicServerId b_10_https_private(HostPortPair("b.com", 10), 39 QuicServerId b_10_https_private(HostPortPair("b.com", 10),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 EXPECT_TRUE(a_11_https_left_private < b_11_https_right_private); 81 EXPECT_TRUE(a_11_https_left_private < b_11_https_right_private);
80 EXPECT_FALSE(b_10_https_left_private < a_10_https_right_private); 82 EXPECT_FALSE(b_10_https_left_private < a_10_https_right_private);
81 EXPECT_TRUE(b_10_https_left_private < a_11_https_right_private); 83 EXPECT_TRUE(b_10_https_left_private < a_11_https_right_private);
82 EXPECT_TRUE(b_10_https_left_private < b_11_https_right_private); 84 EXPECT_TRUE(b_10_https_left_private < b_11_https_right_private);
83 EXPECT_FALSE(b_11_https_left_private < a_10_https_right_private); 85 EXPECT_FALSE(b_11_https_left_private < a_10_https_right_private);
84 EXPECT_FALSE(b_11_https_left_private < a_11_https_right_private); 86 EXPECT_FALSE(b_11_https_left_private < a_11_https_right_private);
85 EXPECT_FALSE(b_11_https_left_private < b_10_https_right_private); 87 EXPECT_FALSE(b_11_https_left_private < b_10_https_right_private);
86 } 88 }
87 } 89 }
88 90
89 TEST(QuicServerIdTest, Equals) { 91 TEST_F(QuicServerIdTest, Equals) {
90 PrivacyMode left_privacy; 92 PrivacyMode left_privacy;
91 PrivacyMode right_privacy; 93 PrivacyMode right_privacy;
92 for (int i = 0; i < 2; i++) { 94 for (int i = 0; i < 2; i++) {
93 left_privacy = right_privacy = static_cast<PrivacyMode>(i); 95 left_privacy = right_privacy = static_cast<PrivacyMode>(i);
94 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), 96 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10),
95 right_privacy); 97 right_privacy);
96 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), 98 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11),
97 right_privacy); 99 right_privacy);
98 QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), 100 QuicServerId b_10_https_right_private(HostPortPair("b.com", 10),
99 right_privacy); 101 right_privacy);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 QuicServerId a_10_https_private(HostPortPair("a.com", 10), 138 QuicServerId a_10_https_private(HostPortPair("a.com", 10),
137 PRIVACY_MODE_ENABLED); 139 PRIVACY_MODE_ENABLED);
138 QuicServerId new_a_10_https_no_private(HostPortPair("a.com", 10), 140 QuicServerId new_a_10_https_no_private(HostPortPair("a.com", 10),
139 PRIVACY_MODE_DISABLED); 141 PRIVACY_MODE_DISABLED);
140 EXPECT_FALSE(new_a_10_https_no_private == a_10_https_private); 142 EXPECT_FALSE(new_a_10_https_no_private == a_10_https_private);
141 } 143 }
142 144
143 } // namespace 145 } // namespace
144 146
145 } // namespace net 147 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_sent_packet_manager_test.cc ('k') | net/quic/core/quic_server_session_base_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698