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/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"
13 TEST(DhcpProxyScriptFetcherFactoryTest
, DoNothingWhenDisabled
) {
14 DhcpProxyScriptFetcherFactory factory
;
15 factory
.set_enabled(false);
16 scoped_ptr
<DhcpProxyScriptFetcher
> fetcher(factory
.Create(NULL
));
17 EXPECT_EQ("", fetcher
->GetFetcherName());
21 TEST(DhcpProxyScriptFetcherFactoryTest
, WindowsFetcherOnWindows
) {
22 DhcpProxyScriptFetcherFactory factory
;
23 factory
.set_enabled(true);
25 scoped_ptr
<TestURLRequestContext
> context(new TestURLRequestContext());
26 scoped_ptr
<DhcpProxyScriptFetcher
> fetcher(factory
.Create(context
.get()));
27 EXPECT_EQ("win", fetcher
->GetFetcherName());
29 #endif // defined(OS_WIN)
31 TEST(DhcpProxyScriptFetcherFactoryTest
, IsSupported
) {
33 ASSERT_TRUE(DhcpProxyScriptFetcherFactory::IsSupported());
35 ASSERT_FALSE(DhcpProxyScriptFetcherFactory::IsSupported());
36 #endif // defined(OS_WIN)
39 TEST(DhcpProxyScriptFetcherFactoryTest
, SetEnabled
) {
40 DhcpProxyScriptFetcherFactory factory
;
42 EXPECT_TRUE(factory
.enabled());
44 EXPECT_FALSE(factory
.enabled());
45 #endif // defined(OS_WIN)
47 factory
.set_enabled(false);
48 EXPECT_FALSE(factory
.enabled());
50 factory
.set_enabled(true);
52 EXPECT_TRUE(factory
.enabled());
54 EXPECT_FALSE(factory
.enabled());
55 #endif // defined(OS_WIN)