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

Side by Side Diff: net/proxy/proxy_list_unittest.cc

Issue 662553002: Convert ARRAYSIZE_UNSAFE -> arraysize in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/proxy/proxy_config_unittest.cc ('k') | net/proxy/proxy_server_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/proxy/proxy_list.h" 5 #include "net/proxy/proxy_list.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/base/net_log.h" 8 #include "net/base/net_log.h"
9 #include "net/proxy/proxy_retry_info.h" 9 #include "net/proxy/proxy_retry_info.h"
10 #include "net/proxy/proxy_server.h" 10 #include "net/proxy/proxy_server.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 "DIRECT", 51 "DIRECT",
52 }, 52 },
53 { "PROXY", 53 { "PROXY",
54 "DIRECT", 54 "DIRECT",
55 }, 55 },
56 { "PROXY foopy1 ; JUNK ; JUNK ; SOCKS5 foopy2 ; ;", 56 { "PROXY foopy1 ; JUNK ; JUNK ; SOCKS5 foopy2 ; ;",
57 "PROXY foopy1:80;SOCKS5 foopy2:1080", 57 "PROXY foopy1:80;SOCKS5 foopy2:1080",
58 }, 58 },
59 }; 59 };
60 60
61 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 61 for (size_t i = 0; i < arraysize(tests); ++i) {
62 ProxyList list; 62 ProxyList list;
63 list.SetFromPacString(tests[i].pac_input); 63 list.SetFromPacString(tests[i].pac_input);
64 EXPECT_EQ(tests[i].pac_output, list.ToPacString()); 64 EXPECT_EQ(tests[i].pac_output, list.ToPacString());
65 EXPECT_FALSE(list.IsEmpty()); 65 EXPECT_FALSE(list.IsEmpty());
66 } 66 }
67 } 67 }
68 68
69 TEST(ProxyListTest, RemoveProxiesWithoutScheme) { 69 TEST(ProxyListTest, RemoveProxiesWithoutScheme) {
70 const struct { 70 const struct {
71 const char* pac_input; 71 const char* pac_input;
72 int filter; 72 int filter;
73 const char* filtered_pac_output; 73 const char* filtered_pac_output;
74 } tests[] = { 74 } tests[] = {
75 { "PROXY foopy:10 ; SOCKS5 foopy2 ; SOCKS foopy11 ; PROXY foopy3 ; DIRECT", 75 { "PROXY foopy:10 ; SOCKS5 foopy2 ; SOCKS foopy11 ; PROXY foopy3 ; DIRECT",
76 // Remove anything that isn't HTTP or DIRECT. 76 // Remove anything that isn't HTTP or DIRECT.
77 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP, 77 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP,
78 "PROXY foopy:10;PROXY foopy3:80;DIRECT", 78 "PROXY foopy:10;PROXY foopy3:80;DIRECT",
79 }, 79 },
80 { "PROXY foopy:10 ; SOCKS5 foopy2", 80 { "PROXY foopy:10 ; SOCKS5 foopy2",
81 // Remove anything that isn't HTTP or SOCKS5. 81 // Remove anything that isn't HTTP or SOCKS5.
82 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_SOCKS4, 82 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_SOCKS4,
83 "", 83 "",
84 }, 84 },
85 }; 85 };
86 86
87 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 87 for (size_t i = 0; i < arraysize(tests); ++i) {
88 ProxyList list; 88 ProxyList list;
89 list.SetFromPacString(tests[i].pac_input); 89 list.SetFromPacString(tests[i].pac_input);
90 list.RemoveProxiesWithoutScheme(tests[i].filter); 90 list.RemoveProxiesWithoutScheme(tests[i].filter);
91 EXPECT_EQ(tests[i].filtered_pac_output, list.ToPacString()); 91 EXPECT_EQ(tests[i].filtered_pac_output, list.ToPacString());
92 } 92 }
93 } 93 }
94 94
95 TEST(ProxyListTest, DeprioritizeBadProxies) { 95 TEST(ProxyListTest, DeprioritizeBadProxies) {
96 // Retry info that marks a proxy as being bad for a *very* long time (to avoid 96 // Retry info that marks a proxy as being bad for a *very* long time (to avoid
97 // the test depending on the current time.) 97 // the test depending on the current time.)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 OK, 245 OK,
246 net_log); 246 net_log);
247 EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy2:80")); 247 EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy2:80"));
248 EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy3:80")); 248 EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy3:80"));
249 } 249 }
250 } 250 }
251 251
252 } // namesapce 252 } // namesapce
253 253
254 } // namespace net 254 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_unittest.cc ('k') | net/proxy/proxy_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698