| 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" |
| 6 #include "net/base/net_util.h" |
| 5 #include "net/proxy/proxy_info.h" | 7 #include "net/proxy/proxy_info.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 9 |
| 8 namespace net { | 10 namespace net { |
| 9 namespace { | 11 namespace { |
| 10 | 12 |
| 11 TEST(ProxyInfoTest, ProxyInfoIsDirectOnly) { | 13 TEST(ProxyInfoTest, ProxyInfoIsDirectOnly) { |
| 12 // Test the is_direct_only() predicate. | 14 // Test the is_direct_only() predicate. |
| 13 ProxyInfo info; | 15 ProxyInfo info; |
| 14 | 16 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 25 EXPECT_FALSE(info.is_direct_only()); | 27 EXPECT_FALSE(info.is_direct_only()); |
| 26 | 28 |
| 27 info.UsePacString("DIRECT; PROXY myproxy:80"); | 29 info.UsePacString("DIRECT; PROXY myproxy:80"); |
| 28 EXPECT_TRUE(info.is_direct()); | 30 EXPECT_TRUE(info.is_direct()); |
| 29 EXPECT_FALSE(info.is_direct_only()); | 31 EXPECT_FALSE(info.is_direct_only()); |
| 30 | 32 |
| 31 info.UsePacString("PROXY myproxy:80; DIRECT"); | 33 info.UsePacString("PROXY myproxy:80; DIRECT"); |
| 32 EXPECT_FALSE(info.is_direct()); | 34 EXPECT_FALSE(info.is_direct()); |
| 33 EXPECT_FALSE(info.is_direct_only()); | 35 EXPECT_FALSE(info.is_direct_only()); |
| 34 // After falling back to direct, we shouldn't consider it DIRECT only. | 36 // After falling back to direct, we shouldn't consider it DIRECT only. |
| 35 EXPECT_TRUE(info.Fallback(BoundNetLog())); | 37 EXPECT_TRUE(info.Fallback(ERR_PROXY_CONNECTION_FAILED, BoundNetLog())); |
| 36 EXPECT_TRUE(info.is_direct()); | 38 EXPECT_TRUE(info.is_direct()); |
| 37 EXPECT_FALSE(info.is_direct_only()); | 39 EXPECT_FALSE(info.is_direct_only()); |
| 38 } | 40 } |
| 39 | 41 |
| 40 } // namespace | 42 } // namespace |
| 41 } // namespace net | 43 } // namespace net |
| OLD | NEW |