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

Side by Side Diff: chrome/browser/chromeos/cros/cros_network_functions_unittest.cc

Issue 10177001: Reimplement CrosSetOfflineMode without Libcros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/chromeos/cros/cros_network_functions.h" 8 #include "chrome/browser/chromeos/cros/cros_network_functions.h"
9 #include "chrome/browser/chromeos/cros/gvalue_util.h" 9 #include "chrome/browser/chromeos/cros/gvalue_util.h"
10 #include "chrome/browser/chromeos/cros/mock_chromeos_network.h" 10 #include "chrome/browser/chromeos/cros/mock_chromeos_network.h"
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 const std::string device_path = "/device/path"; 678 const std::string device_path = "/device/path";
679 const std::string network_id = "networkid"; 679 const std::string network_id = "networkid";
680 void* object = this; 680 void* object = this;
681 EXPECT_CALL(*MockChromeOSNetwork::Get(), RequestCellularRegister( 681 EXPECT_CALL(*MockChromeOSNetwork::Get(), RequestCellularRegister(
682 StrEq(device_path), StrEq(network_id), &OnNetworkAction, object)) 682 StrEq(device_path), StrEq(network_id), &OnNetworkAction, object))
683 .Times(1); 683 .Times(1);
684 CrosRequestCellularRegister(device_path, network_id, &OnNetworkAction, 684 CrosRequestCellularRegister(device_path, network_id, &OnNetworkAction,
685 object); 685 object);
686 } 686 }
687 687
688 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosSetOfflineMode) {
689 const bool kOffline = true;
690 EXPECT_CALL(*MockChromeOSNetwork::Get(), SetOfflineMode(kOffline)).Times(1);
691 CrosSetOfflineMode(kOffline);
692 }
693
688 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosAddIPConfig) { 694 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosAddIPConfig) {
689 const std::string device_path = "/device/path"; 695 const std::string device_path = "/device/path";
690 EXPECT_CALL(*MockChromeOSNetwork::Get(), 696 EXPECT_CALL(*MockChromeOSNetwork::Get(),
691 AddIPConfig(StrEq(device_path), IPCONFIG_TYPE_DHCP)).Times(1); 697 AddIPConfig(StrEq(device_path), IPCONFIG_TYPE_DHCP)).Times(1);
692 CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP); 698 CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP);
693 } 699 }
694 700
695 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosRemoveIPConfig) { 701 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosRemoveIPConfig) {
696 IPConfig config = {}; 702 IPConfig config = {};
697 config.path = "/path"; 703 config.path = "/path";
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 Register(dbus::ObjectPath(device_path), network_id, _, _)) 1311 Register(dbus::ObjectPath(device_path), network_id, _, _))
1306 .WillOnce(SaveArg<2>(&callback)); 1312 .WillOnce(SaveArg<2>(&callback));
1307 EXPECT_CALL(*this, MockNetworkActionCallback( 1313 EXPECT_CALL(*this, MockNetworkActionCallback(
1308 object, StrEq(device_path), NETWORK_METHOD_ERROR_NONE, _)).Times(1); 1314 object, StrEq(device_path), NETWORK_METHOD_ERROR_NONE, _)).Times(1);
1309 CrosRequestCellularRegister(device_path, network_id, 1315 CrosRequestCellularRegister(device_path, network_id,
1310 &MockNetworkActionCallbackThunk, object); 1316 &MockNetworkActionCallbackThunk, object);
1311 // Run saved callback. 1317 // Run saved callback.
1312 callback.Run(); 1318 callback.Run();
1313 } 1319 }
1314 1320
1321 TEST_F(CrosNetworkFunctionsTest, CrosSetOfflineMode) {
1322 const bool kOffline = true;
1323 const base::FundamentalValue value(kOffline);
1324 EXPECT_CALL(*mock_manager_client_, SetProperty(
1325 flimflam::kOfflineModeProperty, IsEqualTo(&value), _)).Times(1);
1326 CrosSetOfflineMode(kOffline);
1327 }
1328
1315 TEST_F(CrosNetworkFunctionsTest, CrosAddIPConfig) { 1329 TEST_F(CrosNetworkFunctionsTest, CrosAddIPConfig) {
1316 const std::string device_path = "/device/path"; 1330 const std::string device_path = "/device/path";
1317 const dbus::ObjectPath result_path("/result/path"); 1331 const dbus::ObjectPath result_path("/result/path");
1318 EXPECT_CALL(*mock_device_client_, 1332 EXPECT_CALL(*mock_device_client_,
1319 CallAddIPConfigAndBlock(dbus::ObjectPath(device_path), 1333 CallAddIPConfigAndBlock(dbus::ObjectPath(device_path),
1320 flimflam::kTypeDHCP)) 1334 flimflam::kTypeDHCP))
1321 .WillOnce(Return(result_path)); 1335 .WillOnce(Return(result_path));
1322 EXPECT_TRUE(CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP)); 1336 EXPECT_TRUE(CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP));
1323 } 1337 }
1324 1338
(...skipping 12 matching lines...) Expand all
1337 const std::string string2 = "string2"; 1351 const std::string string2 = "string2";
1338 base::DictionaryValue value; 1352 base::DictionaryValue value;
1339 value.SetString(key1, string1); 1353 value.SetString(key1, string1);
1340 value.SetString(key2, string2); 1354 value.SetString(key2, string2);
1341 EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _)) 1355 EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _))
1342 .Times(1); 1356 .Times(1);
1343 CrosConfigureService(value); 1357 CrosConfigureService(value);
1344 } 1358 }
1345 1359
1346 } // namespace chromeos 1360 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/cros_network_functions.cc ('k') | chrome/browser/chromeos/cros/mock_chromeos_network.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698