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

Side by Side Diff: chrome/browser/prefs/proxy_config_dictionary_unittest.cc

Issue 6871019: Enable (optional) blocking of webrequests in case a PAC script cannot be fetched or is invalid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 <string> 5 #include <string>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/prefs/proxy_config_dictionary.h" 9 #include "chrome/browser/prefs/proxy_config_dictionary.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 25 matching lines...) Expand all
36 36
37 ASSERT_TRUE(dict.GetMode(&h.mode)); 37 ASSERT_TRUE(dict.GetMode(&h.mode));
38 EXPECT_EQ(ProxyPrefs::MODE_AUTO_DETECT, h.mode); 38 EXPECT_EQ(ProxyPrefs::MODE_AUTO_DETECT, h.mode);
39 ASSERT_FALSE(dict.GetPacUrl(&h.bypass_list)); 39 ASSERT_FALSE(dict.GetPacUrl(&h.bypass_list));
40 ASSERT_FALSE(dict.GetProxyServer(&h.proxy_server)); 40 ASSERT_FALSE(dict.GetProxyServer(&h.proxy_server));
41 ASSERT_FALSE(dict.GetBypassList(&h.bypass_list)); 41 ASSERT_FALSE(dict.GetBypassList(&h.bypass_list));
42 } 42 }
43 43
44 TEST(ProxyConfigDictionaryTest, CreatePacScript) { 44 TEST(ProxyConfigDictionaryTest, CreatePacScript) {
45 scoped_ptr<DictionaryValue> dict_value( 45 scoped_ptr<DictionaryValue> dict_value(
46 ProxyConfigDictionary::CreatePacScript("pac")); 46 ProxyConfigDictionary::CreatePacScript("pac", false));
47 ProxyConfigDictionary dict(dict_value.get()); 47 ProxyConfigDictionary dict(dict_value.get());
48 ProxyConfigHolder h; 48 ProxyConfigHolder h;
49 49
50 ASSERT_TRUE(dict.GetMode(&h.mode)); 50 ASSERT_TRUE(dict.GetMode(&h.mode));
51 EXPECT_EQ(ProxyPrefs::MODE_PAC_SCRIPT, h.mode); 51 EXPECT_EQ(ProxyPrefs::MODE_PAC_SCRIPT, h.mode);
52 ASSERT_TRUE(dict.GetPacUrl(&h.bypass_list)); 52 ASSERT_TRUE(dict.GetPacUrl(&h.bypass_list));
53 EXPECT_EQ("pac", h.bypass_list); 53 EXPECT_EQ("pac", h.bypass_list);
54 ASSERT_FALSE(dict.GetProxyServer(&h.proxy_server)); 54 ASSERT_FALSE(dict.GetProxyServer(&h.proxy_server));
55 ASSERT_FALSE(dict.GetBypassList(&h.bypass_list)); 55 ASSERT_FALSE(dict.GetBypassList(&h.bypass_list));
56 } 56 }
(...skipping 18 matching lines...) Expand all
75 scoped_ptr<DictionaryValue> dict_value(ProxyConfigDictionary::CreateSystem()); 75 scoped_ptr<DictionaryValue> dict_value(ProxyConfigDictionary::CreateSystem());
76 ProxyConfigDictionary dict(dict_value.get()); 76 ProxyConfigDictionary dict(dict_value.get());
77 ProxyConfigHolder h; 77 ProxyConfigHolder h;
78 78
79 ASSERT_TRUE(dict.GetMode(&h.mode)); 79 ASSERT_TRUE(dict.GetMode(&h.mode));
80 EXPECT_EQ(ProxyPrefs::MODE_SYSTEM, h.mode); 80 EXPECT_EQ(ProxyPrefs::MODE_SYSTEM, h.mode);
81 ASSERT_FALSE(dict.GetPacUrl(&h.bypass_list)); 81 ASSERT_FALSE(dict.GetPacUrl(&h.bypass_list));
82 ASSERT_FALSE(dict.GetProxyServer(&h.proxy_server)); 82 ASSERT_FALSE(dict.GetProxyServer(&h.proxy_server));
83 ASSERT_FALSE(dict.GetBypassList(&h.bypass_list)); 83 ASSERT_FALSE(dict.GetBypassList(&h.bypass_list));
84 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698