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

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

Issue 14137017: Add TechnologyState to NetworkStateHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | chromeos/network/shill_property_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 NetworkStateHandler::kMatchTypeWireless)->path()); 209 NetworkStateHandler::kMatchTypeWireless)->path());
210 EXPECT_EQ(flimflam::kStateOnline, 210 EXPECT_EQ(flimflam::kStateOnline,
211 test_observer_->default_network_connection_state()); 211 test_observer_->default_network_connection_state());
212 } 212 }
213 213
214 TEST_F(NetworkStateHandlerTest, TechnologyChanged) { 214 TEST_F(NetworkStateHandlerTest, TechnologyChanged) {
215 SetupNetworkStateHandler(); 215 SetupNetworkStateHandler();
216 message_loop_.RunUntilIdle(); 216 message_loop_.RunUntilIdle();
217 EXPECT_EQ(1u, test_observer_->manager_changed_count()); 217 EXPECT_EQ(1u, test_observer_->manager_changed_count());
218 // Enable a technology. 218 // Enable a technology.
219 EXPECT_FALSE(network_state_handler_->TechnologyEnabled(flimflam::kTypeWimax)); 219 EXPECT_NE(NetworkStateHandler::TECHNOLOGY_ENABLED,
220 network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
220 network_state_handler_->SetTechnologyEnabled( 221 network_state_handler_->SetTechnologyEnabled(
221 flimflam::kTypeWimax, true, network_handler::ErrorCallback()); 222 flimflam::kTypeWimax, true, network_handler::ErrorCallback());
223 // The technology state should immediately change to ENABLING and we should
224 // receive a manager changed callback.
225 EXPECT_EQ(2u, test_observer_->manager_changed_count());
226 EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_ENABLING,
227 network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
222 message_loop_.RunUntilIdle(); 228 message_loop_.RunUntilIdle();
223 // Ensure we get a manager changed callback when we change a property. 229 // Ensure we receive another manager changed callbacks when the technology
224 EXPECT_EQ(2u, test_observer_->manager_changed_count()); 230 // becomes enabled.
225 EXPECT_TRUE(network_state_handler_->TechnologyEnabled(flimflam::kTypeWimax)); 231 EXPECT_EQ(3u, test_observer_->manager_changed_count());
232 EXPECT_EQ(NetworkStateHandler::TECHNOLOGY_ENABLED,
233 network_state_handler_->GetTechnologyState(flimflam::kTypeWimax));
226 } 234 }
227 235
228 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) { 236 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) {
229 SetupNetworkStateHandler(); 237 SetupNetworkStateHandler();
230 message_loop_.RunUntilIdle(); 238 message_loop_.RunUntilIdle();
231 // Set a service property. 239 // Set a service property.
232 const std::string eth0 = "stub_ethernet"; 240 const std::string eth0 = "stub_ethernet";
233 EXPECT_EQ("", network_state_handler_->GetNetworkState(eth0)->security()); 241 EXPECT_EQ("", network_state_handler_->GetNetworkState(eth0)->security());
234 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth0)); 242 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth0));
235 base::StringValue security_value("TestSecurity"); 243 base::StringValue security_value("TestSecurity");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // No default network updates for signal strength changes. 312 // No default network updates for signal strength changes.
305 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 313 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
306 dbus::ObjectPath(wifi1), 314 dbus::ObjectPath(wifi1),
307 flimflam::kSignalStrengthProperty, base::FundamentalValue(32), 315 flimflam::kSignalStrengthProperty, base::FundamentalValue(32),
308 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); 316 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
309 message_loop_.RunUntilIdle(); 317 message_loop_.RunUntilIdle();
310 EXPECT_EQ(3u, test_observer_->default_network_change_count()); 318 EXPECT_EQ(3u, test_observer_->default_network_change_count());
311 } 319 }
312 320
313 } // namespace chromeos 321 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | chromeos/network/shill_property_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698