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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 EXPECT_EQ(kNumShillManagerClientStubImplServices, | 302 EXPECT_EQ(kNumShillManagerClientStubImplServices, |
303 listener_->entries(shill::kServicesProperty).size()); | 303 listener_->entries(shill::kServicesProperty).size()); |
304 | 304 |
305 EXPECT_EQ(0, listener_->errors()); | 305 EXPECT_EQ(0, listener_->errors()); |
306 } | 306 } |
307 | 307 |
308 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerTechnologyChanged) { | 308 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerTechnologyChanged) { |
309 const int initial_technology_updates = 2; // Available and Enabled lists | 309 const int initial_technology_updates = 2; // Available and Enabled lists |
310 EXPECT_EQ(initial_technology_updates, listener_->technology_list_updates()); | 310 EXPECT_EQ(initial_technology_updates, listener_->technology_list_updates()); |
311 | 311 |
312 // Remove a technology. Updates both the Available and Enabled lists. | 312 // Remove an enabled technology. Updates both the Available and Enabled lists. |
313 manager_test_->RemoveTechnology(shill::kTypeWimax); | 313 manager_test_->RemoveTechnology(shill::kTypeWifi); |
314 message_loop_.RunUntilIdle(); | 314 message_loop_.RunUntilIdle(); |
315 EXPECT_EQ(initial_technology_updates + 2, | 315 EXPECT_EQ(initial_technology_updates + 2, |
316 listener_->technology_list_updates()); | 316 listener_->technology_list_updates()); |
317 | 317 |
318 // Add a disabled technology. | 318 // Add a disabled technology. |
319 manager_test_->AddTechnology(shill::kTypeWimax, false); | 319 manager_test_->AddTechnology(shill::kTypeWifi, false); |
320 message_loop_.RunUntilIdle(); | 320 message_loop_.RunUntilIdle(); |
321 EXPECT_EQ(initial_technology_updates + 3, | 321 EXPECT_EQ(initial_technology_updates + 3, |
322 listener_->technology_list_updates()); | 322 listener_->technology_list_updates()); |
323 EXPECT_TRUE(shill_property_handler_->IsTechnologyAvailable( | 323 EXPECT_TRUE(shill_property_handler_->IsTechnologyAvailable( |
324 shill::kTypeWimax)); | 324 shill::kTypeWifi)); |
325 EXPECT_FALSE(shill_property_handler_->IsTechnologyEnabled(shill::kTypeWimax)); | 325 EXPECT_FALSE(shill_property_handler_->IsTechnologyEnabled(shill::kTypeWifi)); |
326 | 326 |
327 // Enable the technology. | 327 // Enable the technology. |
328 DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology( | 328 DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology( |
329 shill::kTypeWimax, | 329 shill::kTypeWifi, |
330 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 330 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
331 message_loop_.RunUntilIdle(); | 331 message_loop_.RunUntilIdle(); |
332 EXPECT_EQ(initial_technology_updates + 4, | 332 EXPECT_EQ(initial_technology_updates + 4, |
333 listener_->technology_list_updates()); | 333 listener_->technology_list_updates()); |
334 EXPECT_TRUE(shill_property_handler_->IsTechnologyEnabled(shill::kTypeWimax)); | 334 EXPECT_TRUE(shill_property_handler_->IsTechnologyEnabled(shill::kTypeWifi)); |
335 | 335 |
336 EXPECT_EQ(0, listener_->errors()); | 336 EXPECT_EQ(0, listener_->errors()); |
337 } | 337 } |
338 | 338 |
339 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerDevicePropertyChanged) { | 339 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerDevicePropertyChanged) { |
340 const size_t kNumShillManagerClientStubImplDevices = 2; | 340 const size_t kNumShillManagerClientStubImplDevices = 2; |
341 EXPECT_EQ(kNumShillManagerClientStubImplDevices, | 341 EXPECT_EQ(kNumShillManagerClientStubImplDevices, |
342 listener_->entries(shill::kDevicesProperty).size()); | 342 listener_->entries(shill::kDevicesProperty).size()); |
343 // Add a device. | 343 // Add a device. |
344 listener_->reset_list_updates(); | 344 listener_->reset_list_updates(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 message_loop_.RunUntilIdle(); | 534 message_loop_.RunUntilIdle(); |
535 // Property change should trigger an update for the Network only; no | 535 // Property change should trigger an update for the Network only; no |
536 // property updates pushed by Shill affect Favorites. | 536 // property updates pushed by Shill affect Favorites. |
537 EXPECT_EQ(2, listener_->property_updates( | 537 EXPECT_EQ(2, listener_->property_updates( |
538 shill::kServicesProperty)[kTestServicePath2]); | 538 shill::kServicesProperty)[kTestServicePath2]); |
539 EXPECT_EQ(0, listener_->property_updates( | 539 EXPECT_EQ(0, listener_->property_updates( |
540 shill::kServiceCompleteListProperty)[kTestServicePath2]); | 540 shill::kServiceCompleteListProperty)[kTestServicePath2]); |
541 } | 541 } |
542 | 542 |
543 } // namespace chromeos | 543 } // namespace chromeos |
OLD | NEW |