OLD | NEW |
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 589 } |
590 | 590 |
591 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosRequestNetworkDeviceEnable) { | 591 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosRequestNetworkDeviceEnable) { |
592 const bool kEnable = true; | 592 const bool kEnable = true; |
593 EXPECT_CALL(*MockChromeOSNetwork::Get(), | 593 EXPECT_CALL(*MockChromeOSNetwork::Get(), |
594 RequestNetworkDeviceEnable(StrEq(flimflam::kTypeWifi), kEnable)) | 594 RequestNetworkDeviceEnable(StrEq(flimflam::kTypeWifi), kEnable)) |
595 .Times(1); | 595 .Times(1); |
596 CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kEnable); | 596 CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kEnable); |
597 } | 597 } |
598 | 598 |
| 599 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosSetOfflineMode) { |
| 600 const bool kOffline = true; |
| 601 EXPECT_CALL(*MockChromeOSNetwork::Get(), SetOfflineMode(kOffline)).Times(1); |
| 602 CrosSetOfflineMode(kOffline); |
| 603 } |
| 604 |
599 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosAddIPConfig) { | 605 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosAddIPConfig) { |
600 const std::string device_path = "/device/path"; | 606 const std::string device_path = "/device/path"; |
601 EXPECT_CALL(*MockChromeOSNetwork::Get(), | 607 EXPECT_CALL(*MockChromeOSNetwork::Get(), |
602 AddIPConfig(StrEq(device_path), IPCONFIG_TYPE_DHCP)).Times(1); | 608 AddIPConfig(StrEq(device_path), IPCONFIG_TYPE_DHCP)).Times(1); |
603 CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP); | 609 CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP); |
604 } | 610 } |
605 | 611 |
606 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosRemoveIPConfig) { | 612 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosRemoveIPConfig) { |
607 IPConfig config = {}; | 613 IPConfig config = {}; |
608 config.path = "/path"; | 614 config.path = "/path"; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 EXPECT_CALL(*mock_manager_client_, | 1007 EXPECT_CALL(*mock_manager_client_, |
1002 EnableTechnology(flimflam::kTypeWifi, _)).Times(1); | 1008 EnableTechnology(flimflam::kTypeWifi, _)).Times(1); |
1003 CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kEnable); | 1009 CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kEnable); |
1004 | 1010 |
1005 const bool kDisable = false; | 1011 const bool kDisable = false; |
1006 EXPECT_CALL(*mock_manager_client_, | 1012 EXPECT_CALL(*mock_manager_client_, |
1007 DisableTechnology(flimflam::kTypeWifi, _)).Times(1); | 1013 DisableTechnology(flimflam::kTypeWifi, _)).Times(1); |
1008 CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kDisable); | 1014 CrosRequestNetworkDeviceEnable(flimflam::kTypeWifi, kDisable); |
1009 } | 1015 } |
1010 | 1016 |
| 1017 TEST_F(CrosNetworkFunctionsTest, CrosSetOfflineMode) { |
| 1018 const bool kOffline = true; |
| 1019 const base::FundamentalValue value(kOffline); |
| 1020 EXPECT_CALL(*mock_manager_client_, CallSetPropertyAndBlock( |
| 1021 flimflam::kOfflineModeProperty, IsEqualTo(&value))).Times(1); |
| 1022 CrosSetOfflineMode(kOffline); |
| 1023 } |
| 1024 |
1011 TEST_F(CrosNetworkFunctionsTest, CrosAddIPConfig) { | 1025 TEST_F(CrosNetworkFunctionsTest, CrosAddIPConfig) { |
1012 const std::string device_path = "/device/path"; | 1026 const std::string device_path = "/device/path"; |
1013 const dbus::ObjectPath result_path("/result/path"); | 1027 const dbus::ObjectPath result_path("/result/path"); |
1014 EXPECT_CALL(*mock_device_client_, | 1028 EXPECT_CALL(*mock_device_client_, |
1015 CallAddIPConfigAndBlock(dbus::ObjectPath(device_path), | 1029 CallAddIPConfigAndBlock(dbus::ObjectPath(device_path), |
1016 flimflam::kTypeDHCP)) | 1030 flimflam::kTypeDHCP)) |
1017 .WillOnce(Return(result_path)); | 1031 .WillOnce(Return(result_path)); |
1018 EXPECT_TRUE(CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP)); | 1032 EXPECT_TRUE(CrosAddIPConfig(device_path, IPCONFIG_TYPE_DHCP)); |
1019 } | 1033 } |
1020 | 1034 |
(...skipping 12 matching lines...) Expand all Loading... |
1033 const std::string string2 = "string2"; | 1047 const std::string string2 = "string2"; |
1034 base::DictionaryValue value; | 1048 base::DictionaryValue value; |
1035 value.SetString(key1, string1); | 1049 value.SetString(key1, string1); |
1036 value.SetString(key2, string2); | 1050 value.SetString(key2, string2); |
1037 EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _)) | 1051 EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _)) |
1038 .Times(1); | 1052 .Times(1); |
1039 CrosConfigureService(value); | 1053 CrosConfigureService(value); |
1040 } | 1054 } |
1041 | 1055 |
1042 } // namespace chromeos | 1056 } // namespace chromeos |
OLD | NEW |