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

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: remove dependencies for NetworkHandler in ShillPropertyHandlerTest.ProhibitedTechnologies 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 public: 222 public:
223 ManagedNetworkConfigurationHandlerTest() 223 ManagedNetworkConfigurationHandlerTest()
224 : mock_manager_client_(NULL), 224 : mock_manager_client_(NULL),
225 mock_profile_client_(NULL), 225 mock_profile_client_(NULL),
226 mock_service_client_(NULL) { 226 mock_service_client_(NULL) {
227 } 227 }
228 228
229 ~ManagedNetworkConfigurationHandlerTest() override {} 229 ~ManagedNetworkConfigurationHandlerTest() override {}
230 230
231 void SetUp() override { 231 void SetUp() override {
232 LoginState::Initialize();
232 scoped_ptr<DBusThreadManagerSetter> dbus_setter = 233 scoped_ptr<DBusThreadManagerSetter> dbus_setter =
233 DBusThreadManager::GetSetterForTesting(); 234 DBusThreadManager::GetSetterForTesting();
234 mock_manager_client_ = new StrictMock<MockShillManagerClient>(); 235 mock_manager_client_ = new StrictMock<MockShillManagerClient>();
235 mock_profile_client_ = new StrictMock<MockShillProfileClient>(); 236 mock_profile_client_ = new StrictMock<MockShillProfileClient>();
236 mock_service_client_ = new StrictMock<MockShillServiceClient>(); 237 mock_service_client_ = new StrictMock<MockShillServiceClient>();
237 dbus_setter->SetShillManagerClient( 238 dbus_setter->SetShillManagerClient(
238 scoped_ptr<ShillManagerClient>(mock_manager_client_).Pass()); 239 scoped_ptr<ShillManagerClient>(mock_manager_client_).Pass());
239 dbus_setter->SetShillProfileClient( 240 dbus_setter->SetShillProfileClient(
240 scoped_ptr<ShillProfileClient>(mock_profile_client_).Pass()); 241 scoped_ptr<ShillProfileClient>(mock_profile_client_).Pass());
241 dbus_setter->SetShillServiceClient( 242 dbus_setter->SetShillServiceClient(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 &global_network_config); 331 &global_network_config);
331 332
332 managed_handler()->SetPolicy( 333 managed_handler()->SetPolicy(
333 onc_source, userhash, *network_configs, *global_network_config); 334 onc_source, userhash, *network_configs, *global_network_config);
334 } 335 }
335 336
336 void SetNetworkConfigurationHandlerExpectations() { 337 void SetNetworkConfigurationHandlerExpectations() {
337 // These calls occur in NetworkConfigurationHandler. 338 // These calls occur in NetworkConfigurationHandler.
338 EXPECT_CALL(*mock_manager_client_, GetProperties(_)).Times(AnyNumber()); 339 EXPECT_CALL(*mock_manager_client_, GetProperties(_)).Times(AnyNumber());
339 EXPECT_CALL(*mock_manager_client_, 340 EXPECT_CALL(*mock_manager_client_,
340 AddPropertyChangedObserver(_)).Times(AnyNumber()); 341 SetProperty("ProhibitedTechnologies", _, _, _))
342 .Times(AnyNumber());
343 EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_))
344 .Times(AnyNumber());
341 EXPECT_CALL(*mock_manager_client_, 345 EXPECT_CALL(*mock_manager_client_,
342 RemovePropertyChangedObserver(_)).Times(AnyNumber()); 346 RemovePropertyChangedObserver(_)).Times(AnyNumber());
343 } 347 }
344 348
345 ManagedNetworkConfigurationHandler* managed_handler() { 349 ManagedNetworkConfigurationHandler* managed_handler() {
346 return managed_network_configuration_handler_.get(); 350 return managed_network_configuration_handler_.get();
347 } 351 }
348 352
349 void GetManagedProperties(const std::string& userhash, 353 void GetManagedProperties(const std::string& userhash,
350 const std::string& service_path) { 354 const std::string& service_path) {
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 EXPECT_CALL(*mock_profile_client_, 978 EXPECT_CALL(*mock_profile_client_,
975 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); 979 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _));
976 980
977 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 981 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
978 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); 982 managed_network_configuration_handler_->RemoveObserver(&policy_observer_);
979 managed_network_configuration_handler_.reset(); 983 managed_network_configuration_handler_.reset();
980 message_loop_.RunUntilIdle(); 984 message_loop_.RunUntilIdle();
981 } 985 }
982 986
983 } // namespace chromeos 987 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698