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

Side by Side Diff: chromeos/network/shill_property_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/shill_property_handler.cc ('k') | no next file » | 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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 ShillManagerClient::TestInterface* manager_test_; 242 ShillManagerClient::TestInterface* manager_test_;
243 ShillDeviceClient::TestInterface* device_test_; 243 ShillDeviceClient::TestInterface* device_test_;
244 ShillServiceClient::TestInterface* service_test_; 244 ShillServiceClient::TestInterface* service_test_;
245 245
246 private: 246 private:
247 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandlerTest); 247 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandlerTest);
248 }; 248 };
249 249
250 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerStub) { 250 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerStub) {
251 EXPECT_EQ(1, listener_->manager_updates()); 251 EXPECT_EQ(1, listener_->manager_updates());
252 EXPECT_TRUE(shill_property_handler_->TechnologyAvailable( 252 EXPECT_TRUE(shill_property_handler_->IsTechnologyAvailable(
253 flimflam::kTypeWifi)); 253 flimflam::kTypeWifi));
254 EXPECT_TRUE(shill_property_handler_->TechnologyEnabled( 254 EXPECT_TRUE(shill_property_handler_->IsTechnologyEnabled(
255 flimflam::kTypeWifi)); 255 flimflam::kTypeWifi));
256 const size_t kNumShillManagerClientStubImplDevices = 2; 256 const size_t kNumShillManagerClientStubImplDevices = 2;
257 EXPECT_EQ(kNumShillManagerClientStubImplDevices, 257 EXPECT_EQ(kNumShillManagerClientStubImplDevices,
258 listener_->entries(flimflam::kDevicesProperty).size()); 258 listener_->entries(flimflam::kDevicesProperty).size());
259 const size_t kNumShillManagerClientStubImplServices = 4; 259 const size_t kNumShillManagerClientStubImplServices = 4;
260 EXPECT_EQ(kNumShillManagerClientStubImplServices, 260 EXPECT_EQ(kNumShillManagerClientStubImplServices,
261 listener_->entries(flimflam::kServicesProperty).size()); 261 listener_->entries(flimflam::kServicesProperty).size());
262 262
263 EXPECT_EQ(0, listener_->errors()); 263 EXPECT_EQ(0, listener_->errors());
264 } 264 }
265 265
266 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerTechnologyChanged) { 266 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerTechnologyChanged) {
267 EXPECT_EQ(1, listener_->manager_updates()); 267 EXPECT_EQ(1, listener_->manager_updates());
268 // Add a disabled technology. 268 // Add a disabled technology.
269 manager_test_->AddTechnology(flimflam::kTypeWimax, false); 269 manager_test_->AddTechnology(flimflam::kTypeWimax, false);
270 message_loop_.RunUntilIdle(); 270 message_loop_.RunUntilIdle();
271 EXPECT_EQ(2, listener_->manager_updates()); 271 EXPECT_EQ(2, listener_->manager_updates());
272 EXPECT_TRUE(shill_property_handler_->TechnologyAvailable( 272 EXPECT_TRUE(shill_property_handler_->IsTechnologyAvailable(
273 flimflam::kTypeWimax)); 273 flimflam::kTypeWimax));
274 EXPECT_FALSE(shill_property_handler_->TechnologyEnabled( 274 EXPECT_FALSE(shill_property_handler_->IsTechnologyEnabled(
275 flimflam::kTypeWimax)); 275 flimflam::kTypeWimax));
276 276
277 // Enable the technology. 277 // Enable the technology.
278 DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology( 278 DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology(
279 flimflam::kTypeWimax, 279 flimflam::kTypeWimax,
280 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); 280 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction));
281 message_loop_.RunUntilIdle(); 281 message_loop_.RunUntilIdle();
282 EXPECT_EQ(3, listener_->manager_updates()); 282 EXPECT_EQ(3, listener_->manager_updates());
283 EXPECT_TRUE(shill_property_handler_->TechnologyEnabled( 283 EXPECT_TRUE(shill_property_handler_->IsTechnologyEnabled(
284 flimflam::kTypeWimax)); 284 flimflam::kTypeWimax));
285 285
286 EXPECT_EQ(0, listener_->errors()); 286 EXPECT_EQ(0, listener_->errors());
287 } 287 }
288 288
289 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerDevicePropertyChanged) { 289 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerDevicePropertyChanged) {
290 EXPECT_EQ(1, listener_->manager_updates()); 290 EXPECT_EQ(1, listener_->manager_updates());
291 EXPECT_EQ(1, listener_->list_updates(flimflam::kDevicesProperty)); 291 EXPECT_EQ(1, listener_->list_updates(flimflam::kDevicesProperty));
292 const size_t kNumShillManagerClientStubImplDevices = 2; 292 const size_t kNumShillManagerClientStubImplDevices = 2;
293 EXPECT_EQ(kNumShillManagerClientStubImplDevices, 293 EXPECT_EQ(kNumShillManagerClientStubImplDevices,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 AddServiceWithIPConfig(flimflam::kTypeWifi, kTestServicePath2, 418 AddServiceWithIPConfig(flimflam::kTypeWifi, kTestServicePath2,
419 flimflam::kStateIdle, kTestIPConfigPath, true); 419 flimflam::kStateIdle, kTestIPConfigPath, true);
420 message_loop_.RunUntilIdle(); 420 message_loop_.RunUntilIdle();
421 // A watched service with the IPConfig property already set must 421 // A watched service with the IPConfig property already set must
422 // trigger property updates for IP Address and DNS when added. 422 // trigger property updates for IP Address and DNS when added.
423 EXPECT_EQ(3, listener_-> 423 EXPECT_EQ(3, listener_->
424 property_updates(flimflam::kServicesProperty)[kTestServicePath2]); 424 property_updates(flimflam::kServicesProperty)[kTestServicePath2]);
425 } 425 }
426 426
427 } // namespace chromeos 427 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/shill_property_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698