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

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

Issue 6831025: Adds support for the DHCP portion of the WPAD (proxy auto-discovery) protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Isolate worker thread to separate object. Refcount context. Fix mandatory PAC. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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/proxy/dhcp_proxy_script_fetcher.h"
6 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
7 #include "net/url_request/url_request_test_util.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace net {
11 namespace {
12
13 TEST(DhcpProxyScriptFetcherFactoryTest, DoNothingWhenDisabled) {
14 DhcpProxyScriptFetcherFactory factory;
15 // Non-do-nothing fetchers would DCHECK on the NULL pointer.
16 DhcpProxyScriptFetcher* fetcher = factory.Create(NULL);
17 ASSERT_TRUE(fetcher);
18 EXPECT_EQ("", fetcher->GetFetcherName());
19 }
20
21 #if defined(OS_WIN)
22 TEST(DhcpProxyScriptFetcherFactoryTest, WindowsFetcherOnWindows) {
23 DhcpProxyScriptFetcherFactory factory;
24 factory.set_enabled(true);
25
26 scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
27 DhcpProxyScriptFetcher* fetcher = factory.Create(context);
28 ASSERT_TRUE(fetcher);
29 EXPECT_EQ("win", fetcher->GetFetcherName());
30 }
31 #endif // defined(OS_WIN)
32
33 TEST(DhcpProxyScriptFetcherFactoryTest, IsSupported) {
34 #if defined(OS_WIN)
35 ASSERT_TRUE(DhcpProxyScriptFetcherFactory::IsSupported());
36 #else
37 ASSERT_FALSE(DhcpProxyScriptFetcherFactory::IsSupported());
38 #endif // defined(OS_WIN)
39 }
40
41 TEST(DhcpProxyScriptFetcherFactoryTest, SetEnabled) {
42 DhcpProxyScriptFetcherFactory factory;
43 EXPECT_FALSE(factory.enabled());
44
45 factory.set_enabled(false);
46 EXPECT_FALSE(factory.enabled());
47
48 factory.set_enabled(true);
49 #if defined(OS_WIN)
50 EXPECT_TRUE(factory.enabled());
51 #else
52 EXPECT_FALSE(factory.enabled());
53 #endif // defined(OS_WIN)
54 }
55
56 } // namespace
57 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698