| OLD | NEW |
| 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 "chromeos/network/shill_property_handler.h" | 5 #include "chromeos/network/shill_property_handler.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ASSERT_TRUE(manager_test_); | 176 ASSERT_TRUE(manager_test_); |
| 177 device_test_ = | 177 device_test_ = |
| 178 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); | 178 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); |
| 179 ASSERT_TRUE(device_test_); | 179 ASSERT_TRUE(device_test_); |
| 180 service_test_ = | 180 service_test_ = |
| 181 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 181 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
| 182 ASSERT_TRUE(service_test_); | 182 ASSERT_TRUE(service_test_); |
| 183 profile_test_ = | 183 profile_test_ = |
| 184 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); | 184 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); |
| 185 ASSERT_TRUE(profile_test_); | 185 ASSERT_TRUE(profile_test_); |
| 186 if (!LoginState::IsInitialized()) |
| 187 LoginState::Initialize(); |
| 186 SetupShillPropertyHandler(); | 188 SetupShillPropertyHandler(); |
| 187 message_loop_.RunUntilIdle(); | 189 message_loop_.RunUntilIdle(); |
| 188 } | 190 } |
| 189 | 191 |
| 190 void TearDown() override { | 192 void TearDown() override { |
| 191 shill_property_handler_.reset(); | 193 shill_property_handler_.reset(); |
| 192 listener_.reset(); | 194 listener_.reset(); |
| 193 DBusThreadManager::Shutdown(); | 195 DBusThreadManager::Shutdown(); |
| 194 } | 196 } |
| 195 | 197 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 AddServiceToProfile(shill::kTypeWifi, kTestServicePath2, true); | 496 AddServiceToProfile(shill::kTypeWifi, kTestServicePath2, true); |
| 495 shill_property_handler_->UpdateManagerProperties(); | 497 shill_property_handler_->UpdateManagerProperties(); |
| 496 message_loop_.RunUntilIdle(); | 498 message_loop_.RunUntilIdle(); |
| 497 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); | 499 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); |
| 498 EXPECT_EQ(1, listener_->initial_property_updates( | 500 EXPECT_EQ(1, listener_->initial_property_updates( |
| 499 shill::kServiceCompleteListProperty)[kTestServicePath2]); | 501 shill::kServiceCompleteListProperty)[kTestServicePath2]); |
| 500 EXPECT_EQ(1, listener_->property_updates( | 502 EXPECT_EQ(1, listener_->property_updates( |
| 501 shill::kServiceCompleteListProperty)[kTestServicePath2]); | 503 shill::kServiceCompleteListProperty)[kTestServicePath2]); |
| 502 } | 504 } |
| 503 | 505 |
| 506 TEST_F(ShillPropertyHandlerTest, ProhibitedTechnologies) { |
| 507 std::vector<std::string> prohibited_technologies; |
| 508 prohibited_technologies.push_back(shill::kTypeEthernet); |
| 509 EXPECT_TRUE( |
| 510 shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet)); |
| 511 shill_property_handler_->SetProhibitedTechnologies( |
| 512 prohibited_technologies, network_handler::ErrorCallback()); |
| 513 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE, |
| 514 LoginState::LOGGED_IN_USER_REGULAR); |
| 515 shill_property_handler_->UserPolicyApplied(); |
| 516 message_loop_.RunUntilIdle(); |
| 517 // Disabled at user session |
| 518 EXPECT_FALSE( |
| 519 shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet)); |
| 520 |
| 521 // Can not enable it back |
| 522 shill_property_handler_->SetTechnologyEnabled( |
| 523 shill::kTypeEthernet, true, network_handler::ErrorCallback()); |
| 524 message_loop_.RunUntilIdle(); |
| 525 EXPECT_FALSE( |
| 526 shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet)); |
| 527 |
| 528 // Can enable it back after policy changes |
| 529 prohibited_technologies.clear(); |
| 530 shill_property_handler_->SetProhibitedTechnologies( |
| 531 prohibited_technologies, network_handler::ErrorCallback()); |
| 532 shill_property_handler_->SetTechnologyEnabled( |
| 533 shill::kTypeEthernet, true, network_handler::ErrorCallback()); |
| 534 message_loop_.RunUntilIdle(); |
| 535 EXPECT_TRUE( |
| 536 shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet)); |
| 537 } |
| 538 |
| 504 } // namespace chromeos | 539 } // namespace chromeos |
| OLD | NEW |