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

Side by Side Diff: components/policy/core/browser/proxy_policy_handler_unittest.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: one constructor Created 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/policy/core/browser/proxy_policy_handler.h" 5 #include "components/policy/core/browser/proxy_policy_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 30 matching lines...) Expand all
41 // Verify that all the proxy prefs are set to the specified expected values. 41 // Verify that all the proxy prefs are set to the specified expected values.
42 void VerifyProxyPrefs( 42 void VerifyProxyPrefs(
43 const std::string& expected_proxy_server, 43 const std::string& expected_proxy_server,
44 const std::string& expected_proxy_pac_url, 44 const std::string& expected_proxy_pac_url,
45 const std::string& expected_proxy_bypass_list, 45 const std::string& expected_proxy_bypass_list,
46 const ProxyPrefs::ProxyMode& expected_proxy_mode) { 46 const ProxyPrefs::ProxyMode& expected_proxy_mode) {
47 const base::Value* value = NULL; 47 const base::Value* value = NULL;
48 ASSERT_TRUE(store_->GetValue(proxy_config::prefs::kProxy, &value)); 48 ASSERT_TRUE(store_->GetValue(proxy_config::prefs::kProxy, &value));
49 ASSERT_EQ(base::Value::Type::DICTIONARY, value->GetType()); 49 ASSERT_EQ(base::Value::Type::DICTIONARY, value->GetType());
50 ProxyConfigDictionary dict( 50 ProxyConfigDictionary dict(
51 static_cast<const base::DictionaryValue*>(value)); 51 static_cast<const base::DictionaryValue*>(value)->CreateDeepCopy());
52 std::string s; 52 std::string s;
53 if (expected_proxy_server.empty()) { 53 if (expected_proxy_server.empty()) {
54 EXPECT_FALSE(dict.GetProxyServer(&s)); 54 EXPECT_FALSE(dict.GetProxyServer(&s));
55 } else { 55 } else {
56 ASSERT_TRUE(dict.GetProxyServer(&s)); 56 ASSERT_TRUE(dict.GetProxyServer(&s));
57 EXPECT_EQ(expected_proxy_server, s); 57 EXPECT_EQ(expected_proxy_server, s);
58 } 58 }
59 if (expected_proxy_pac_url.empty()) { 59 if (expected_proxy_pac_url.empty()) {
60 EXPECT_FALSE(dict.GetPacUrl(&s)); 60 EXPECT_FALSE(dict.GetPacUrl(&s));
61 } else { 61 } else {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 for (int i = 0; i < ProxyPolicyHandler::MODE_COUNT; ++i) { 296 for (int i = 0; i < ProxyPolicyHandler::MODE_COUNT; ++i) {
297 policy.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 297 policy.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
298 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(i), nullptr); 298 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(i), nullptr);
299 UpdateProviderPolicy(policy); 299 UpdateProviderPolicy(policy);
300 const base::Value* value = nullptr; 300 const base::Value* value = nullptr;
301 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); 301 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value));
302 } 302 }
303 } 303 }
304 304
305 } // namespace policy 305 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698