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

Side by Side Diff: chromeos/network/network_state_handler_unittest.cc

Issue 181413006: Replace misc. network stub flags with more flexible ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 months 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 | Annotate | Revision Log
OLDNEW
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 manager_test_->RemoveTechnology(shill::kTypeWimax); 313 manager_test_->RemoveTechnology(shill::kTypeWimax);
314 message_loop_.RunUntilIdle(); 314 message_loop_.RunUntilIdle();
315 EXPECT_EQ( 315 EXPECT_EQ(
316 NetworkStateHandler::TECHNOLOGY_UNAVAILABLE, 316 NetworkStateHandler::TECHNOLOGY_UNAVAILABLE,
317 network_state_handler_->GetTechnologyState(NetworkTypePattern::Wimax())); 317 network_state_handler_->GetTechnologyState(NetworkTypePattern::Wimax()));
318 } 318 }
319 319
320 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) { 320 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) {
321 // Set a service property. 321 // Set a service property.
322 const std::string eth1 = kShillManagerClientStubDefaultService; 322 const std::string eth1 = kShillManagerClientStubDefaultService;
323 EXPECT_EQ("", network_state_handler_->GetNetworkState(eth1)->security()); 323 const NetworkState* ethernet = network_state_handler_->GetNetworkState(eth1);
324 ASSERT_TRUE(ethernet);
325 EXPECT_EQ("", ethernet->security());
324 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth1)); 326 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth1));
325 base::StringValue security_value("TestSecurity"); 327 base::StringValue security_value("TestSecurity");
326 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 328 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
327 dbus::ObjectPath(eth1), 329 dbus::ObjectPath(eth1),
328 shill::kSecurityProperty, security_value, 330 shill::kSecurityProperty, security_value,
329 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); 331 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
330 message_loop_.RunUntilIdle(); 332 message_loop_.RunUntilIdle();
331 EXPECT_EQ("TestSecurity", 333 ethernet = network_state_handler_->GetNetworkState(eth1);
332 network_state_handler_->GetNetworkState(eth1)->security()); 334 EXPECT_EQ("TestSecurity", ethernet->security());
333 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); 335 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1));
334 336
335 // Changing a service to the existing value should not trigger an update. 337 // Changing a service to the existing value should not trigger an update.
336 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 338 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
337 dbus::ObjectPath(eth1), 339 dbus::ObjectPath(eth1),
338 shill::kSecurityProperty, security_value, 340 shill::kSecurityProperty, security_value,
339 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); 341 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
340 message_loop_.RunUntilIdle(); 342 message_loop_.RunUntilIdle();
341 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); 343 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1));
342 } 344 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // Other networks should have 2 updates (inital + request). 486 // Other networks should have 2 updates (inital + request).
485 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( 487 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(
486 kShillManagerClientStubDefaultService)); 488 kShillManagerClientStubDefaultService));
487 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( 489 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(
488 kShillManagerClientStubWireless2)); 490 kShillManagerClientStubWireless2));
489 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( 491 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(
490 kShillManagerClientStubCellular)); 492 kShillManagerClientStubCellular));
491 } 493 }
492 494
493 } // namespace chromeos 495 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | chromeos/network/shill_property_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698