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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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_info.cc ('k') | net/proxy/proxy_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/base/net_errors.h"
6 #include "net/proxy/proxy_config.h"
7 #include "net/proxy/proxy_info.h"
8 #include "net/proxy/proxy_list.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace net {
12 namespace {
13
14 TEST(ProxyInfoTest, ProxyInfoIsDirectOnly) {
15 // Test the is_direct_only() predicate.
16 ProxyInfo info;
17
18 // An empty ProxyInfo is not considered direct.
19 EXPECT_FALSE(info.is_direct_only());
20
21 info.UseDirect();
22 EXPECT_TRUE(info.is_direct_only());
23
24 info.UsePacString("DIRECT");
25 EXPECT_TRUE(info.is_direct_only());
26
27 info.UsePacString("PROXY myproxy:80");
28 EXPECT_FALSE(info.is_direct_only());
29
30 info.UsePacString("DIRECT; PROXY myproxy:80");
31 EXPECT_TRUE(info.is_direct());
32 EXPECT_FALSE(info.is_direct_only());
33
34 info.UsePacString("PROXY myproxy:80; DIRECT");
35 EXPECT_FALSE(info.is_direct());
36 EXPECT_FALSE(info.is_direct_only());
37 EXPECT_EQ(2u, info.proxy_list().size());
38 EXPECT_EQ("PROXY myproxy:80;DIRECT", info.proxy_list().ToPacString());
39 // After falling back to direct, we shouldn't consider it DIRECT only.
40 EXPECT_TRUE(info.Fallback(ERR_PROXY_CONNECTION_FAILED, BoundNetLog()));
41 EXPECT_TRUE(info.is_direct());
42 EXPECT_FALSE(info.is_direct_only());
43 }
44
45 } // namespace
46
47 TEST(ProxyInfoTest, UseVsOverrideProxyList) {
48 ProxyInfo info;
49 info.config_id_ = 99;
50 ProxyList proxy_list;
51 proxy_list.Set("http://foo.com");
52 info.OverrideProxyList(proxy_list);
53 EXPECT_EQ(99, info.config_id_);
54 EXPECT_EQ("PROXY foo.com:80", info.proxy_list().ToPacString());
55 proxy_list.Set("http://bar.com");
56 info.UseProxyList(proxy_list);
57 EXPECT_EQ(0, info.config_id_);
58 EXPECT_EQ("PROXY bar.com:80", info.proxy_list().ToPacString());
59 }
60
61 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_info.cc ('k') | net/proxy/proxy_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698