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/network_state_handler.h" | 5 #include "chromeos/network/network_state_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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 // No default network updates for signal strength changes. | 340 // No default network updates for signal strength changes. |
341 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 341 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
342 dbus::ObjectPath(wifi1), | 342 dbus::ObjectPath(wifi1), |
343 flimflam::kSignalStrengthProperty, base::FundamentalValue(32), | 343 flimflam::kSignalStrengthProperty, base::FundamentalValue(32), |
344 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 344 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
345 message_loop_.RunUntilIdle(); | 345 message_loop_.RunUntilIdle(); |
346 EXPECT_EQ(3u, test_observer_->default_network_change_count()); | 346 EXPECT_EQ(3u, test_observer_->default_network_change_count()); |
347 } | 347 } |
348 | 348 |
| 349 TEST_F(NetworkStateHandlerTest, RequestUpdate) { |
| 350 // Request an update for kShillManagerClientStubDefaultWireless. |
| 351 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService( |
| 352 kShillManagerClientStubDefaultWireless)); |
| 353 EXPECT_TRUE(network_state_handler_->RequestUpdateForNetwork( |
| 354 kShillManagerClientStubDefaultWireless)); |
| 355 message_loop_.RunUntilIdle(); |
| 356 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 357 kShillManagerClientStubDefaultWireless)); |
| 358 |
| 359 // Request an update for all networks. |
| 360 network_state_handler_->RequestUpdateForAllNetworks(); |
| 361 message_loop_.RunUntilIdle(); |
| 362 // kShillManagerClientStubDefaultWireless should now have 3 updates |
| 363 EXPECT_EQ(3, test_observer_->PropertyUpdatesForService( |
| 364 kShillManagerClientStubDefaultWireless)); |
| 365 // Other networks should have 2 updates (inital + request). |
| 366 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 367 kShillManagerClientStubDefaultService)); |
| 368 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 369 kShillManagerClientStubWireless2)); |
| 370 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 371 kShillManagerClientStubCellular)); |
| 372 } |
| 373 |
349 } // namespace chromeos | 374 } // namespace chromeos |
OLD | NEW |