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

Side by Side Diff: chrome/browser/chromeos/policy/network_configuration_updater_impl_cros_unittest.cc

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros .h" 5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros .h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 PolicyServiceImpl::Providers providers; 100 PolicyServiceImpl::Providers providers;
101 providers.push_back(&provider_); 101 providers.push_back(&provider_);
102 policy_service_.reset(new PolicyServiceImpl(providers)); 102 policy_service_.reset(new PolicyServiceImpl(providers));
103 103
104 empty_network_configs_.reset(new base::ListValue); 104 empty_network_configs_.reset(new base::ListValue);
105 empty_certificates_.reset(new base::ListValue); 105 empty_certificates_.reset(new base::ListValue);
106 106
107 scoped_ptr<base::DictionaryValue> fake_toplevel_onc = 107 scoped_ptr<base::DictionaryValue> fake_toplevel_onc =
108 onc::ReadDictionaryFromJson(kFakeONC); 108 onc::ReadDictionaryFromJson(kFakeONC);
109 109
110 base::Value* network_configs_value = NULL; 110 scoped_ptr<base::Value> network_configs_value;
111 base::ListValue* network_configs = NULL; 111 base::ListValue* network_configs = NULL;
112 fake_toplevel_onc->RemoveWithoutPathExpansion( 112 fake_toplevel_onc->RemoveWithoutPathExpansion(
113 onc::toplevel_config::kNetworkConfigurations, 113 onc::toplevel_config::kNetworkConfigurations,
114 &network_configs_value); 114 &network_configs_value);
115 network_configs_value->GetAsList(&network_configs); 115 network_configs_value.release()->GetAsList(&network_configs);
116 fake_network_configs_.reset(network_configs); 116 fake_network_configs_.reset(network_configs);
117 117
118 base::Value* certs_value = NULL; 118 scoped_ptr<base::Value> certs_value;
119 base::ListValue* certs = NULL; 119 base::ListValue* certs = NULL;
120 fake_toplevel_onc->RemoveWithoutPathExpansion( 120 fake_toplevel_onc->RemoveWithoutPathExpansion(
121 onc::toplevel_config::kCertificates, 121 onc::toplevel_config::kCertificates,
122 &certs_value); 122 &certs_value);
123 certs_value->GetAsList(&certs); 123 certs_value.release()->GetAsList(&certs);
124 fake_certificates_.reset(certs); 124 fake_certificates_.reset(certs);
125 } 125 }
126 126
127 virtual void TearDown() OVERRIDE { 127 virtual void TearDown() OVERRIDE {
128 provider_.Shutdown(); 128 provider_.Shutdown();
129 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); 129 content::RunAllPendingInMessageLoop(content::BrowserThread::IO);
130 } 130 }
131 131
132 void UpdateProviderPolicy(const PolicyMap& policy) { 132 void UpdateProviderPolicy(const PolicyMap& policy) {
133 provider_.UpdateChromePolicy(policy); 133 provider_.UpdateChromePolicy(policy);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 updater.UnsetUserPolicyService(); 409 updater.UnsetUserPolicyService();
410 } 410 }
411 411
412 INSTANTIATE_TEST_CASE_P( 412 INSTANTIATE_TEST_CASE_P(
413 NetworkConfigurationUpdaterTestWithParamInstance, 413 NetworkConfigurationUpdaterTestWithParamInstance,
414 NetworkConfigurationUpdaterTestWithParam, 414 NetworkConfigurationUpdaterTestWithParam,
415 testing::Values(key::kDeviceOpenNetworkConfiguration, 415 testing::Values(key::kDeviceOpenNetworkConfiguration,
416 key::kOpenNetworkConfiguration)); 416 key::kOpenNetworkConfiguration));
417 417
418 } // namespace policy 418 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698