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.
5 #include "net/proxy/proxy_info.h"
6 #include "testing/gtest/include/gtest/gtest.h"
11 TEST(ProxyInfoTest
, ProxyInfoIsDirectOnly
) {
12 // Test the is_direct_only() predicate.
15 // An empty ProxyInfo is not considered direct.
16 EXPECT_FALSE(info
.is_direct_only());
19 EXPECT_TRUE(info
.is_direct_only());
21 info
.UsePacString("DIRECT");
22 EXPECT_TRUE(info
.is_direct_only());
24 info
.UsePacString("PROXY myproxy:80");
25 EXPECT_FALSE(info
.is_direct_only());
27 info
.UsePacString("DIRECT; PROXY myproxy:80");
28 EXPECT_TRUE(info
.is_direct());
29 EXPECT_FALSE(info
.is_direct_only());
31 info
.UsePacString("PROXY myproxy:80; DIRECT");
32 EXPECT_FALSE(info
.is_direct());
33 EXPECT_FALSE(info
.is_direct_only());
34 // After falling back to direct, we shouldn't consider it DIRECT only.
35 EXPECT_TRUE(info
.Fallback(BoundNetLog()));
36 EXPECT_TRUE(info
.is_direct());
37 EXPECT_FALSE(info
.is_direct_only());