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

Side by Side Diff: net/http/http_server_properties_impl_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http/http_server_properties_impl.h" 5 #include "net/http/http_server_properties_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // servers. 58 // servers.
59 std::vector<std::string> spdy_servers2; 59 std::vector<std::string> spdy_servers2;
60 spdy_servers2.push_back(spdy_server_g); 60 spdy_servers2.push_back(spdy_server_g);
61 spdy_servers2.push_back(spdy_server_d); 61 spdy_servers2.push_back(spdy_server_d);
62 impl_.InitializeSpdyServers(&spdy_servers2, true); 62 impl_.InitializeSpdyServers(&spdy_servers2, true);
63 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google)); 63 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google));
64 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_docs)); 64 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_docs));
65 } 65 }
66 66
67 TEST_F(SpdyServerPropertiesTest, SupportsSpdyTest) { 67 TEST_F(SpdyServerPropertiesTest, SupportsSpdyTest) {
68 HostPortPair spdy_server_empty("", 443); 68 HostPortPair spdy_server_empty(std::string(), 443);
69 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_empty)); 69 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_empty));
70 70
71 // Add www.google.com:443 as supporting SPDY. 71 // Add www.google.com:443 as supporting SPDY.
72 HostPortPair spdy_server_google("www.google.com", 443); 72 HostPortPair spdy_server_google("www.google.com", 443);
73 impl_.SetSupportsSpdy(spdy_server_google, true); 73 impl_.SetSupportsSpdy(spdy_server_google, true);
74 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google)); 74 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google));
75 75
76 // Add mail.google.com:443 as not supporting SPDY. 76 // Add mail.google.com:443 as not supporting SPDY.
77 HostPortPair spdy_server_mail("mail.google.com", 443); 77 HostPortPair spdy_server_mail("mail.google.com", 443);
78 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_mail)); 78 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_mail));
79 79
80 // Add docs.google.com:443 as supporting SPDY. 80 // Add docs.google.com:443 as supporting SPDY.
81 HostPortPair spdy_server_docs("docs.google.com", 443); 81 HostPortPair spdy_server_docs("docs.google.com", 443);
82 impl_.SetSupportsSpdy(spdy_server_docs, true); 82 impl_.SetSupportsSpdy(spdy_server_docs, true);
83 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_docs)); 83 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_docs));
84 84
85 // Verify all the entries are the same after additions. 85 // Verify all the entries are the same after additions.
86 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google)); 86 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google));
87 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_mail)); 87 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_mail));
88 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_docs)); 88 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_docs));
89 } 89 }
90 90
91 TEST_F(SpdyServerPropertiesTest, SetSupportsSpdy) { 91 TEST_F(SpdyServerPropertiesTest, SetSupportsSpdy) {
92 HostPortPair spdy_server_empty("", 443); 92 HostPortPair spdy_server_empty(std::string(), 443);
93 impl_.SetSupportsSpdy(spdy_server_empty, true); 93 impl_.SetSupportsSpdy(spdy_server_empty, true);
94 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_empty)); 94 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_empty));
95 95
96 // Add www.google.com:443 as supporting SPDY. 96 // Add www.google.com:443 as supporting SPDY.
97 HostPortPair spdy_server_google("www.google.com", 443); 97 HostPortPair spdy_server_google("www.google.com", 443);
98 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_google)); 98 EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_google));
99 impl_.SetSupportsSpdy(spdy_server_google, true); 99 impl_.SetSupportsSpdy(spdy_server_google, true);
100 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google)); 100 EXPECT_TRUE(impl_.SupportsSpdy(spdy_server_google));
101 101
102 // Make www.google.com:443 as not supporting SPDY. 102 // Make www.google.com:443 as not supporting SPDY.
(...skipping 24 matching lines...) Expand all
127 } 127 }
128 128
129 TEST_F(SpdyServerPropertiesTest, GetSpdyServerList) { 129 TEST_F(SpdyServerPropertiesTest, GetSpdyServerList) {
130 base::ListValue spdy_server_list; 130 base::ListValue spdy_server_list;
131 131
132 // Check there are no spdy_servers. 132 // Check there are no spdy_servers.
133 impl_.GetSpdyServerList(&spdy_server_list); 133 impl_.GetSpdyServerList(&spdy_server_list);
134 EXPECT_EQ(0U, spdy_server_list.GetSize()); 134 EXPECT_EQ(0U, spdy_server_list.GetSize());
135 135
136 // Check empty server is not added. 136 // Check empty server is not added.
137 HostPortPair spdy_server_empty("", 443); 137 HostPortPair spdy_server_empty(std::string(), 443);
138 impl_.SetSupportsSpdy(spdy_server_empty, true); 138 impl_.SetSupportsSpdy(spdy_server_empty, true);
139 impl_.GetSpdyServerList(&spdy_server_list); 139 impl_.GetSpdyServerList(&spdy_server_list);
140 EXPECT_EQ(0U, spdy_server_list.GetSize()); 140 EXPECT_EQ(0U, spdy_server_list.GetSize());
141 141
142 std::string string_value_g; 142 std::string string_value_g;
143 std::string string_value_m; 143 std::string string_value_m;
144 HostPortPair spdy_server_google("www.google.com", 443); 144 HostPortPair spdy_server_google("www.google.com", 443);
145 std::string spdy_server_g = 145 std::string spdy_server_g =
146 HttpServerPropertiesImpl::GetFlattenedSpdyServer(spdy_server_google); 146 HttpServerPropertiesImpl::GetFlattenedSpdyServer(spdy_server_google);
147 HostPortPair spdy_server_mail("mail.google.com", 443); 147 HostPortPair spdy_server_mail("mail.google.com", 443);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 const SettingsMap& settings_map2 = impl_.GetSpdySettings(spdy_server_google); 296 const SettingsMap& settings_map2 = impl_.GetSpdySettings(spdy_server_google);
297 ASSERT_EQ(1U, settings_map2.size()); 297 ASSERT_EQ(1U, settings_map2.size());
298 SettingsMap::const_iterator it = settings_map2.find(id); 298 SettingsMap::const_iterator it = settings_map2.find(id);
299 EXPECT_TRUE(it != settings_map2.end()); 299 EXPECT_TRUE(it != settings_map2.end());
300 SettingsFlagsAndValue flags_and_value2 = it->second; 300 SettingsFlagsAndValue flags_and_value2 = it->second;
301 EXPECT_EQ(flags, flags_and_value2.first); 301 EXPECT_EQ(flags, flags_and_value2.first);
302 EXPECT_EQ(value, flags_and_value2.second); 302 EXPECT_EQ(value, flags_and_value2.second);
303 } 303 }
304 304
305 TEST_F(SpdySettingsServerPropertiesTest, SetSpdySetting) { 305 TEST_F(SpdySettingsServerPropertiesTest, SetSpdySetting) {
306 HostPortPair spdy_server_empty("", 443); 306 HostPortPair spdy_server_empty(std::string(), 443);
307 const SettingsMap& settings_map0 = impl_.GetSpdySettings(spdy_server_empty); 307 const SettingsMap& settings_map0 = impl_.GetSpdySettings(spdy_server_empty);
308 EXPECT_EQ(0U, settings_map0.size()); // Returns kEmptySettingsMap. 308 EXPECT_EQ(0U, settings_map0.size()); // Returns kEmptySettingsMap.
309 309
310 // Add www.google.com:443 as persisting. 310 // Add www.google.com:443 as persisting.
311 HostPortPair spdy_server_google("www.google.com", 443); 311 HostPortPair spdy_server_google("www.google.com", 443);
312 const SpdySettingsIds id1 = SETTINGS_UPLOAD_BANDWIDTH; 312 const SpdySettingsIds id1 = SETTINGS_UPLOAD_BANDWIDTH;
313 const SpdySettingsFlags flags1 = SETTINGS_FLAG_PLEASE_PERSIST; 313 const SpdySettingsFlags flags1 = SETTINGS_FLAG_PLEASE_PERSIST;
314 const uint32 value1 = 31337; 314 const uint32 value1 = 31337;
315 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_google, id1, flags1, value1)); 315 EXPECT_TRUE(impl_.SetSpdySetting(spdy_server_google, id1, flags1, value1));
316 // Check the values. 316 // Check the values.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 EXPECT_EQ(value3, flags_and_value3_ret.second); 395 EXPECT_EQ(value3, flags_and_value3_ret.second);
396 396
397 impl_.Clear(); 397 impl_.Clear();
398 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size()); 398 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size());
399 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size()); 399 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size());
400 } 400 }
401 401
402 } // namespace 402 } // namespace
403 403
404 } // namespace net 404 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_security_headers_unittest.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698