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

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

Issue 24348002: Migrate DBus service constants from flimflam namespace to shill namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased to ToT Created 7 years, 2 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
« no previous file with comments | « chromeos/network/network_device_handler.cc ('k') | chromeos/network/network_profile_handler.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_device_handler.h" 5 #include "chromeos/network/network_device_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 26 matching lines...) Expand all
37 base::Bind(&NetworkDeviceHandlerTest::PropertiesSuccessCallback, 37 base::Bind(&NetworkDeviceHandlerTest::PropertiesSuccessCallback,
38 base::Unretained(this)); 38 base::Unretained(this));
39 error_callback_ = base::Bind(&NetworkDeviceHandlerTest::ErrorCallback, 39 error_callback_ = base::Bind(&NetworkDeviceHandlerTest::ErrorCallback,
40 base::Unretained(this)); 40 base::Unretained(this));
41 network_device_handler_.reset(new NetworkDeviceHandler()); 41 network_device_handler_.reset(new NetworkDeviceHandler());
42 42
43 ShillDeviceClient::TestInterface* device_test = 43 ShillDeviceClient::TestInterface* device_test =
44 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); 44 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface();
45 device_test->ClearDevices(); 45 device_test->ClearDevices();
46 device_test->AddDevice( 46 device_test->AddDevice(
47 kDefaultCellularDevicePath, flimflam::kTypeCellular, "cellular1"); 47 kDefaultCellularDevicePath, shill::kTypeCellular, "cellular1");
48 device_test->AddDevice( 48 device_test->AddDevice(kDefaultWifiDevicePath, shill::kTypeWifi, "wifi1");
49 kDefaultWifiDevicePath, flimflam::kTypeWifi, "wifi1");
50 49
51 base::FundamentalValue allow_roaming(false); 50 base::FundamentalValue allow_roaming(false);
52 device_test->SetDeviceProperty( 51 device_test->SetDeviceProperty(
53 kDefaultCellularDevicePath, 52 kDefaultCellularDevicePath,
54 flimflam::kCellularAllowRoamingProperty, 53 shill::kCellularAllowRoamingProperty,
55 allow_roaming); 54 allow_roaming);
56 55
57 base::ListValue test_ip_configs; 56 base::ListValue test_ip_configs;
58 test_ip_configs.AppendString("ip_config1"); 57 test_ip_configs.AppendString("ip_config1");
59 device_test->SetDeviceProperty( 58 device_test->SetDeviceProperty(
60 kDefaultWifiDevicePath, flimflam::kIPConfigsProperty, test_ip_configs); 59 kDefaultWifiDevicePath, shill::kIPConfigsProperty, test_ip_configs);
61 } 60 }
62 61
63 virtual void TearDown() OVERRIDE { 62 virtual void TearDown() OVERRIDE {
64 network_device_handler_.reset(); 63 network_device_handler_.reset();
65 DBusThreadManager::Shutdown(); 64 DBusThreadManager::Shutdown();
66 } 65 }
67 66
68 base::Closure GetErrorInvokingCallback( 67 base::Closure GetErrorInvokingCallback(
69 const std::string& device_path, 68 const std::string& device_path,
70 const std::string& error_name) { 69 const std::string& error_name) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 162 }
164 163
165 TEST_F(NetworkDeviceHandlerTest, GetDeviceProperties) { 164 TEST_F(NetworkDeviceHandlerTest, GetDeviceProperties) {
166 network_device_handler_->GetDeviceProperties( 165 network_device_handler_->GetDeviceProperties(
167 kDefaultWifiDevicePath, 166 kDefaultWifiDevicePath,
168 properties_success_callback_, 167 properties_success_callback_,
169 error_callback_); 168 error_callback_);
170 message_loop_.RunUntilIdle(); 169 message_loop_.RunUntilIdle();
171 EXPECT_EQ(kResultSuccess, result_); 170 EXPECT_EQ(kResultSuccess, result_);
172 std::string type; 171 std::string type;
173 properties_->GetString(flimflam::kTypeProperty, &type); 172 properties_->GetString(shill::kTypeProperty, &type);
174 EXPECT_EQ(flimflam::kTypeWifi, type); 173 EXPECT_EQ(shill::kTypeWifi, type);
175 } 174 }
176 175
177 TEST_F(NetworkDeviceHandlerTest, SetDeviceProperty) { 176 TEST_F(NetworkDeviceHandlerTest, SetDeviceProperty) {
178 // Check that GetDeviceProperties returns the expected initial values. 177 // Check that GetDeviceProperties returns the expected initial values.
179 network_device_handler_->GetDeviceProperties( 178 network_device_handler_->GetDeviceProperties(
180 kDefaultCellularDevicePath, 179 kDefaultCellularDevicePath,
181 properties_success_callback_, 180 properties_success_callback_,
182 error_callback_); 181 error_callback_);
183 message_loop_.RunUntilIdle(); 182 message_loop_.RunUntilIdle();
184 EXPECT_EQ(kResultSuccess, result_); 183 EXPECT_EQ(kResultSuccess, result_);
185 bool allow_roaming; 184 bool allow_roaming;
186 EXPECT_TRUE(properties_->GetBooleanWithoutPathExpansion( 185 EXPECT_TRUE(properties_->GetBooleanWithoutPathExpansion(
187 flimflam::kCellularAllowRoamingProperty, &allow_roaming)); 186 shill::kCellularAllowRoamingProperty, &allow_roaming));
188 EXPECT_FALSE(allow_roaming); 187 EXPECT_FALSE(allow_roaming);
189 188
190 // Set the flimflam::kCellularAllowRoamingProperty to true. The call 189 // Set the shill::kCellularAllowRoamingProperty to true. The call
191 // should succeed and the value should be set. 190 // should succeed and the value should be set.
192 base::FundamentalValue allow_roaming_value(true); 191 base::FundamentalValue allow_roaming_value(true);
193 network_device_handler_->SetDeviceProperty( 192 network_device_handler_->SetDeviceProperty(
194 kDefaultCellularDevicePath, 193 kDefaultCellularDevicePath,
195 flimflam::kCellularAllowRoamingProperty, 194 shill::kCellularAllowRoamingProperty,
196 allow_roaming_value, 195 allow_roaming_value,
197 success_callback_, 196 success_callback_,
198 error_callback_); 197 error_callback_);
199 message_loop_.RunUntilIdle(); 198 message_loop_.RunUntilIdle();
200 EXPECT_EQ(kResultSuccess, result_); 199 EXPECT_EQ(kResultSuccess, result_);
201 200
202 // GetDeviceProperties should return the value set by SetDeviceProperty. 201 // GetDeviceProperties should return the value set by SetDeviceProperty.
203 network_device_handler_->GetDeviceProperties( 202 network_device_handler_->GetDeviceProperties(
204 kDefaultCellularDevicePath, 203 kDefaultCellularDevicePath,
205 properties_success_callback_, 204 properties_success_callback_,
206 error_callback_); 205 error_callback_);
207 message_loop_.RunUntilIdle(); 206 message_loop_.RunUntilIdle();
208 EXPECT_EQ(kResultSuccess, result_); 207 EXPECT_EQ(kResultSuccess, result_);
209 EXPECT_TRUE(properties_->GetBooleanWithoutPathExpansion( 208 EXPECT_TRUE(properties_->GetBooleanWithoutPathExpansion(
210 flimflam::kCellularAllowRoamingProperty, &allow_roaming)); 209 shill::kCellularAllowRoamingProperty, &allow_roaming));
211 EXPECT_TRUE(allow_roaming); 210 EXPECT_TRUE(allow_roaming);
212 211
213 // Set property on an invalid path. 212 // Set property on an invalid path.
214 network_device_handler_->SetDeviceProperty( 213 network_device_handler_->SetDeviceProperty(
215 "/device/invalid_path", 214 "/device/invalid_path",
216 flimflam::kCellularAllowRoamingProperty, 215 shill::kCellularAllowRoamingProperty,
217 allow_roaming_value, 216 allow_roaming_value,
218 success_callback_, 217 success_callback_,
219 error_callback_); 218 error_callback_);
220 message_loop_.RunUntilIdle(); 219 message_loop_.RunUntilIdle();
221 EXPECT_EQ(NetworkDeviceHandler::kErrorFailure, result_); 220 EXPECT_EQ(NetworkDeviceHandler::kErrorFailure, result_);
222 } 221 }
223 222
224 TEST_F(NetworkDeviceHandlerTest, RequestRefreshIPConfigs) { 223 TEST_F(NetworkDeviceHandlerTest, RequestRefreshIPConfigs) {
225 network_device_handler_->RequestRefreshIPConfigs( 224 network_device_handler_->RequestRefreshIPConfigs(
226 kDefaultWifiDevicePath, 225 kDefaultWifiDevicePath,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 kOldPin, 353 kOldPin,
355 kNewPin, 354 kNewPin,
356 GetErrorInvokingCallback(kDefaultCellularDevicePath, 355 GetErrorInvokingCallback(kDefaultCellularDevicePath,
357 "org.chromium.flimflam.Error.PinBlocked"), 356 "org.chromium.flimflam.Error.PinBlocked"),
358 error_callback_); 357 error_callback_);
359 message_loop_.RunUntilIdle(); 358 message_loop_.RunUntilIdle();
360 EXPECT_EQ(NetworkDeviceHandler::kErrorPinBlocked, result_); 359 EXPECT_EQ(NetworkDeviceHandler::kErrorPinBlocked, result_);
361 } 360 }
362 361
363 } // namespace chromeos 362 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_device_handler.cc ('k') | chromeos/network/network_profile_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698