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

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

Issue 14876021: Re-factor network_event_log (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth0)); 267 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth0));
268 base::StringValue security_value("TestSecurity"); 268 base::StringValue security_value("TestSecurity");
269 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 269 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
270 dbus::ObjectPath(eth0), 270 dbus::ObjectPath(eth0),
271 flimflam::kSecurityProperty, security_value, 271 flimflam::kSecurityProperty, security_value,
272 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); 272 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
273 message_loop_.RunUntilIdle(); 273 message_loop_.RunUntilIdle();
274 EXPECT_EQ("TestSecurity", 274 EXPECT_EQ("TestSecurity",
275 network_state_handler_->GetNetworkState(eth0)->security()); 275 network_state_handler_->GetNetworkState(eth0)->security());
276 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth0)); 276 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth0));
277
278 // Changing a service to the exsiting value should not trigger an update.
gauravsh 2013/05/14 00:01:39 existing
stevenjb 2013/05/14 00:27:42 Done.
279 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
280 dbus::ObjectPath(eth0),
281 flimflam::kSecurityProperty, security_value,
282 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
283 message_loop_.RunUntilIdle();
284 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth0));
277 } 285 }
278 286
279 TEST_F(NetworkStateHandlerTest, NetworkConnectionStateChanged) { 287 TEST_F(NetworkStateHandlerTest, NetworkConnectionStateChanged) {
280 // Change a network state. 288 // Change a network state.
281 ShillServiceClient::TestInterface* service_test = 289 ShillServiceClient::TestInterface* service_test =
282 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 290 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
283 const std::string eth0 = "stub_ethernet"; 291 const std::string eth0 = "stub_ethernet";
284 base::StringValue connection_state_idle_value(flimflam::kStateIdle); 292 base::StringValue connection_state_idle_value(flimflam::kStateIdle);
285 service_test->SetServiceProperty(eth0, flimflam::kStateProperty, 293 service_test->SetServiceProperty(eth0, flimflam::kStateProperty,
286 connection_state_idle_value); 294 connection_state_idle_value);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // No default network updates for signal strength changes. 340 // No default network updates for signal strength changes.
333 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 341 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
334 dbus::ObjectPath(wifi1), 342 dbus::ObjectPath(wifi1),
335 flimflam::kSignalStrengthProperty, base::FundamentalValue(32), 343 flimflam::kSignalStrengthProperty, base::FundamentalValue(32),
336 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); 344 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
337 message_loop_.RunUntilIdle(); 345 message_loop_.RunUntilIdle();
338 EXPECT_EQ(3u, test_observer_->default_network_change_count()); 346 EXPECT_EQ(3u, test_observer_->default_network_change_count());
339 } 347 }
340 348
341 } // namespace chromeos 349 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698