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