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

Side by Side Diff: chromeos/network/managed_network_configuration_handler_unittest.cc

Issue 1431563005: Handle prohibited technologies in device policy ONC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <iostream> 5 #include <iostream>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 ON_CALL(*mock_service_client_, GetProperties(_,_)) 254 ON_CALL(*mock_service_client_, GetProperties(_,_))
255 .WillByDefault(Invoke(&services_stub_, 255 .WillByDefault(Invoke(&services_stub_,
256 &ShillServiceTestClient::GetProperties)); 256 &ShillServiceTestClient::GetProperties));
257 257
258 network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); 258 network_state_handler_.reset(NetworkStateHandler::InitializeForTest());
259 network_profile_handler_.reset(new TestNetworkProfileHandler()); 259 network_profile_handler_.reset(new TestNetworkProfileHandler());
260 network_configuration_handler_.reset( 260 network_configuration_handler_.reset(
261 NetworkConfigurationHandler::InitializeForTest( 261 NetworkConfigurationHandler::InitializeForTest(
262 network_state_handler_.get(), 262 network_state_handler_.get(),
263 NULL /* no NetworkDeviceHandler */)); 263 nullptr /* no NetworkDeviceHandler */));
264 managed_network_configuration_handler_.reset( 264 managed_network_configuration_handler_.reset(
265 new ManagedNetworkConfigurationHandlerImpl()); 265 new ManagedNetworkConfigurationHandlerImpl());
266 managed_network_configuration_handler_->Init( 266 managed_network_configuration_handler_->Init(
267 network_state_handler_.get(), 267 network_state_handler_.get(), network_profile_handler_.get(),
268 network_profile_handler_.get(), 268 network_configuration_handler_.get(), nullptr /* no DeviceHandler */,
269 network_configuration_handler_.get(), 269 nullptr /* no ProhibitedTechnologiesHandler */);
270 NULL /* no DeviceHandler */);
271 managed_network_configuration_handler_->AddObserver(&policy_observer_); 270 managed_network_configuration_handler_->AddObserver(&policy_observer_);
272 271
273 message_loop_.RunUntilIdle(); 272 message_loop_.RunUntilIdle();
274 } 273 }
275 274
276 void TearDown() override { 275 void TearDown() override {
277 if (managed_network_configuration_handler_) 276 if (managed_network_configuration_handler_)
278 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); 277 managed_network_configuration_handler_->RemoveObserver(&policy_observer_);
279 network_state_handler_.reset(); 278 network_state_handler_.reset();
280 managed_network_configuration_handler_.reset(); 279 managed_network_configuration_handler_.reset();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 &global_network_config); 329 &global_network_config);
331 330
332 managed_handler()->SetPolicy( 331 managed_handler()->SetPolicy(
333 onc_source, userhash, *network_configs, *global_network_config); 332 onc_source, userhash, *network_configs, *global_network_config);
334 } 333 }
335 334
336 void SetNetworkConfigurationHandlerExpectations() { 335 void SetNetworkConfigurationHandlerExpectations() {
337 // These calls occur in NetworkConfigurationHandler. 336 // These calls occur in NetworkConfigurationHandler.
338 EXPECT_CALL(*mock_manager_client_, GetProperties(_)).Times(AnyNumber()); 337 EXPECT_CALL(*mock_manager_client_, GetProperties(_)).Times(AnyNumber());
339 EXPECT_CALL(*mock_manager_client_, 338 EXPECT_CALL(*mock_manager_client_,
340 AddPropertyChangedObserver(_)).Times(AnyNumber()); 339 SetProperty("ProhibitedTechnologies", _, _, _))
340 .Times(AnyNumber());
341 EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_))
342 .Times(AnyNumber());
341 EXPECT_CALL(*mock_manager_client_, 343 EXPECT_CALL(*mock_manager_client_,
342 RemovePropertyChangedObserver(_)).Times(AnyNumber()); 344 RemovePropertyChangedObserver(_)).Times(AnyNumber());
343 } 345 }
344 346
345 ManagedNetworkConfigurationHandler* managed_handler() { 347 ManagedNetworkConfigurationHandler* managed_handler() {
346 return managed_network_configuration_handler_.get(); 348 return managed_network_configuration_handler_.get();
347 } 349 }
348 350
349 void GetManagedProperties(const std::string& userhash, 351 void GetManagedProperties(const std::string& userhash,
350 const std::string& service_path) { 352 const std::string& service_path) {
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 EXPECT_CALL(*mock_profile_client_, 976 EXPECT_CALL(*mock_profile_client_,
975 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); 977 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _));
976 978
977 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 979 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
978 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); 980 managed_network_configuration_handler_->RemoveObserver(&policy_observer_);
979 managed_network_configuration_handler_.reset(); 981 managed_network_configuration_handler_.reset();
980 message_loop_.RunUntilIdle(); 982 message_loop_.RunUntilIdle();
981 } 983 }
982 984
983 } // namespace chromeos 985 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698