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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 protected: | 179 protected: |
180 ScopedGValue argument_gvalue_; | 180 ScopedGValue argument_gvalue_; |
181 ScopedGHashTable argument_ghash_table_; | 181 ScopedGHashTable argument_ghash_table_; |
182 ScopedGHashTable result_ghash_table_; | 182 ScopedGHashTable result_ghash_table_; |
183 base::Callback<void(const char* path, | 183 base::Callback<void(const char* path, |
184 const char* key, | 184 const char* key, |
185 const GValue* gvalue)> property_changed_callback_; | 185 const GValue* gvalue)> property_changed_callback_; |
186 }; | 186 }; |
187 | 187 |
| 188 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosActivateCellularModem) { |
| 189 const std::string service_path = "/"; |
| 190 const std::string carrier = "carrier"; |
| 191 EXPECT_CALL(*MockChromeOSNetwork::Get(), |
| 192 ActivateCellularModem(StrEq(service_path), StrEq(carrier))) |
| 193 .Times(1); |
| 194 CrosActivateCellularModem(service_path, carrier); |
| 195 } |
| 196 |
188 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosSetNetworkServiceProperty) { | 197 TEST_F(CrosNetworkFunctionsLibcrosTest, CrosSetNetworkServiceProperty) { |
189 const std::string service_path = "/"; | 198 const std::string service_path = "/"; |
190 const std::string property = "property"; | 199 const std::string property = "property"; |
191 EXPECT_CALL( | 200 EXPECT_CALL( |
192 *MockChromeOSNetwork::Get(), | 201 *MockChromeOSNetwork::Get(), |
193 SetNetworkServicePropertyGValue(StrEq(service_path), StrEq(property), _)) | 202 SetNetworkServicePropertyGValue(StrEq(service_path), StrEq(property), _)) |
194 .WillOnce(Invoke( | 203 .WillOnce(Invoke( |
195 this, &CrosNetworkFunctionsLibcrosTest::OnSetNetworkPropertyGValue)); | 204 this, &CrosNetworkFunctionsLibcrosTest::OnSetNetworkPropertyGValue)); |
196 const std::string key1= "key1"; | 205 const std::string key1= "key1"; |
197 const std::string string1 = "string1"; | 206 const std::string string1 = "string1"; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 protected: | 734 protected: |
726 MockCashewClient* mock_cashew_client_; | 735 MockCashewClient* mock_cashew_client_; |
727 MockFlimflamDeviceClient* mock_device_client_; | 736 MockFlimflamDeviceClient* mock_device_client_; |
728 MockFlimflamIPConfigClient* mock_ipconfig_client_; | 737 MockFlimflamIPConfigClient* mock_ipconfig_client_; |
729 MockFlimflamManagerClient* mock_manager_client_; | 738 MockFlimflamManagerClient* mock_manager_client_; |
730 MockFlimflamProfileClient* mock_profile_client_; | 739 MockFlimflamProfileClient* mock_profile_client_; |
731 MockFlimflamServiceClient* mock_service_client_; | 740 MockFlimflamServiceClient* mock_service_client_; |
732 const base::DictionaryValue* dictionary_value_result_; | 741 const base::DictionaryValue* dictionary_value_result_; |
733 }; | 742 }; |
734 | 743 |
| 744 TEST_F(CrosNetworkFunctionsTest, CrosActivateCellularModem) { |
| 745 const std::string service_path = "/"; |
| 746 const std::string carrier = "carrier"; |
| 747 EXPECT_CALL(*mock_service_client_, |
| 748 CallActivateCellularModemAndBlock(dbus::ObjectPath(service_path), |
| 749 carrier)) |
| 750 .WillOnce(Return(true)); |
| 751 EXPECT_TRUE(CrosActivateCellularModem(service_path, carrier)); |
| 752 } |
| 753 |
735 TEST_F(CrosNetworkFunctionsTest, CrosSetNetworkServiceProperty) { | 754 TEST_F(CrosNetworkFunctionsTest, CrosSetNetworkServiceProperty) { |
736 const std::string service_path = "/"; | 755 const std::string service_path = "/"; |
737 const std::string property = "property"; | 756 const std::string property = "property"; |
738 const std::string key1 = "key1"; | 757 const std::string key1 = "key1"; |
739 const std::string string1 = "string1"; | 758 const std::string string1 = "string1"; |
740 const std::string key2 = "key2"; | 759 const std::string key2 = "key2"; |
741 const std::string string2 = "string2"; | 760 const std::string string2 = "string2"; |
742 base::DictionaryValue value; | 761 base::DictionaryValue value; |
743 value.SetString(key1, string1); | 762 value.SetString(key1, string1); |
744 value.SetString(key2, string2); | 763 value.SetString(key2, string2); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 const std::string string2 = "string2"; | 1052 const std::string string2 = "string2"; |
1034 base::DictionaryValue value; | 1053 base::DictionaryValue value; |
1035 value.SetString(key1, string1); | 1054 value.SetString(key1, string1); |
1036 value.SetString(key2, string2); | 1055 value.SetString(key2, string2); |
1037 EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _)) | 1056 EXPECT_CALL(*mock_manager_client_, ConfigureService(IsEqualTo(&value), _)) |
1038 .Times(1); | 1057 .Times(1); |
1039 CrosConfigureService(value); | 1058 CrosConfigureService(value); |
1040 } | 1059 } |
1041 | 1060 |
1042 } // namespace chromeos | 1061 } // namespace chromeos |
OLD | NEW |