| OLD | NEW |
| 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/base/net_errors.h" | 5 #include "net/base/net_errors.h" |
| 6 #include "net/proxy/proxy_config.h" | 6 #include "net/proxy/proxy_config.h" |
| 7 #include "net/proxy/proxy_info.h" | 7 #include "net/proxy/proxy_info.h" |
| 8 #include "net/proxy/proxy_list.h" | 8 #include "net/proxy/proxy_list.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 info.UsePacString("DIRECT; PROXY myproxy:80"); | 30 info.UsePacString("DIRECT; PROXY myproxy:80"); |
| 31 EXPECT_TRUE(info.is_direct()); | 31 EXPECT_TRUE(info.is_direct()); |
| 32 EXPECT_FALSE(info.is_direct_only()); | 32 EXPECT_FALSE(info.is_direct_only()); |
| 33 | 33 |
| 34 info.UsePacString("PROXY myproxy:80; DIRECT"); | 34 info.UsePacString("PROXY myproxy:80; DIRECT"); |
| 35 EXPECT_FALSE(info.is_direct()); | 35 EXPECT_FALSE(info.is_direct()); |
| 36 EXPECT_FALSE(info.is_direct_only()); | 36 EXPECT_FALSE(info.is_direct_only()); |
| 37 EXPECT_EQ(2u, info.proxy_list().size()); | 37 EXPECT_EQ(2u, info.proxy_list().size()); |
| 38 EXPECT_EQ("PROXY myproxy:80;DIRECT", info.proxy_list().ToPacString()); | 38 EXPECT_EQ("PROXY myproxy:80;DIRECT", info.proxy_list().ToPacString()); |
| 39 // After falling back to direct, we shouldn't consider it DIRECT only. | 39 // After falling back to direct, we shouldn't consider it DIRECT only. |
| 40 EXPECT_TRUE(info.Fallback(ERR_PROXY_CONNECTION_FAILED, BoundNetLog())); | 40 EXPECT_TRUE(info.Fallback(ERR_PROXY_CONNECTION_FAILED, NetLogWithSource())); |
| 41 EXPECT_TRUE(info.is_direct()); | 41 EXPECT_TRUE(info.is_direct()); |
| 42 EXPECT_FALSE(info.is_direct_only()); | 42 EXPECT_FALSE(info.is_direct_only()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 TEST(ProxyInfoTest, UseVsOverrideProxyList) { | 47 TEST(ProxyInfoTest, UseVsOverrideProxyList) { |
| 48 ProxyInfo info; | 48 ProxyInfo info; |
| 49 info.config_id_ = 99; | 49 info.config_id_ = 99; |
| 50 ProxyList proxy_list; | 50 ProxyList proxy_list; |
| 51 proxy_list.Set("http://foo.com"); | 51 proxy_list.Set("http://foo.com"); |
| 52 info.OverrideProxyList(proxy_list); | 52 info.OverrideProxyList(proxy_list); |
| 53 EXPECT_EQ(99, info.config_id_); | 53 EXPECT_EQ(99, info.config_id_); |
| 54 EXPECT_EQ("PROXY foo.com:80", info.proxy_list().ToPacString()); | 54 EXPECT_EQ("PROXY foo.com:80", info.proxy_list().ToPacString()); |
| 55 proxy_list.Set("http://bar.com"); | 55 proxy_list.Set("http://bar.com"); |
| 56 info.UseProxyList(proxy_list); | 56 info.UseProxyList(proxy_list); |
| 57 EXPECT_EQ(0, info.config_id_); | 57 EXPECT_EQ(0, info.config_id_); |
| 58 EXPECT_EQ("PROXY bar.com:80", info.proxy_list().ToPacString()); | 58 EXPECT_EQ("PROXY bar.com:80", info.proxy_list().ToPacString()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace net | 61 } // namespace net |
| OLD | NEW |