OLD | NEW |
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 "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/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
10 #include "chromeos/dbus/fake_shill_device_client.h" | 10 #include "chromeos/dbus/fake_shill_device_client.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const char kResultSuccess[] = "success"; | 24 const char kResultSuccess[] = "success"; |
25 const char kDefaultPin[] = "1111"; | 25 const char kDefaultPin[] = "1111"; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 class NetworkDeviceHandlerTest : public testing::Test { | 29 class NetworkDeviceHandlerTest : public testing::Test { |
30 public: | 30 public: |
31 NetworkDeviceHandlerTest() : fake_device_client_(NULL) {} | 31 NetworkDeviceHandlerTest() : fake_device_client_(NULL) {} |
32 virtual ~NetworkDeviceHandlerTest() {} | 32 virtual ~NetworkDeviceHandlerTest() {} |
33 | 33 |
34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() override { |
35 fake_device_client_ = new FakeShillDeviceClient; | 35 fake_device_client_ = new FakeShillDeviceClient; |
36 DBusThreadManager::GetSetterForTesting()->SetShillDeviceClient( | 36 DBusThreadManager::GetSetterForTesting()->SetShillDeviceClient( |
37 scoped_ptr<ShillDeviceClient>(fake_device_client_)); | 37 scoped_ptr<ShillDeviceClient>(fake_device_client_)); |
38 | 38 |
39 success_callback_ = base::Bind(&NetworkDeviceHandlerTest::SuccessCallback, | 39 success_callback_ = base::Bind(&NetworkDeviceHandlerTest::SuccessCallback, |
40 base::Unretained(this)); | 40 base::Unretained(this)); |
41 properties_success_callback_ = | 41 properties_success_callback_ = |
42 base::Bind(&NetworkDeviceHandlerTest::PropertiesSuccessCallback, | 42 base::Bind(&NetworkDeviceHandlerTest::PropertiesSuccessCallback, |
43 base::Unretained(this)); | 43 base::Unretained(this)); |
44 string_success_callback_ = | 44 string_success_callback_ = |
(...skipping 15 matching lines...) Expand all Loading... |
60 device_test->AddDevice(kDefaultWifiDevicePath, shill::kTypeWifi, "wifi1"); | 60 device_test->AddDevice(kDefaultWifiDevicePath, shill::kTypeWifi, "wifi1"); |
61 | 61 |
62 base::ListValue test_ip_configs; | 62 base::ListValue test_ip_configs; |
63 test_ip_configs.AppendString("ip_config1"); | 63 test_ip_configs.AppendString("ip_config1"); |
64 device_test->SetDeviceProperty( | 64 device_test->SetDeviceProperty( |
65 kDefaultWifiDevicePath, shill::kIPConfigsProperty, test_ip_configs); | 65 kDefaultWifiDevicePath, shill::kIPConfigsProperty, test_ip_configs); |
66 | 66 |
67 message_loop_.RunUntilIdle(); | 67 message_loop_.RunUntilIdle(); |
68 } | 68 } |
69 | 69 |
70 virtual void TearDown() OVERRIDE { | 70 virtual void TearDown() override { |
71 network_device_handler_.reset(); | 71 network_device_handler_.reset(); |
72 network_state_handler_.reset(); | 72 network_state_handler_.reset(); |
73 DBusThreadManager::Shutdown(); | 73 DBusThreadManager::Shutdown(); |
74 } | 74 } |
75 | 75 |
76 void ErrorCallback(const std::string& error_name, | 76 void ErrorCallback(const std::string& error_name, |
77 scoped_ptr<base::DictionaryValue> error_data) { | 77 scoped_ptr<base::DictionaryValue> error_data) { |
78 LOG(ERROR) << "ErrorCallback: " << error_name; | 78 LOG(ERROR) << "ErrorCallback: " << error_name; |
79 result_ = error_name; | 79 result_ = error_name; |
80 } | 80 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 network_device_handler_->ChangePin(kUnknownCellularDevicePath, | 373 network_device_handler_->ChangePin(kUnknownCellularDevicePath, |
374 kOldPin, | 374 kOldPin, |
375 kNewPin, | 375 kNewPin, |
376 success_callback_, | 376 success_callback_, |
377 error_callback_); | 377 error_callback_); |
378 message_loop_.RunUntilIdle(); | 378 message_loop_.RunUntilIdle(); |
379 EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_); | 379 EXPECT_EQ(NetworkDeviceHandler::kErrorDeviceMissing, result_); |
380 } | 380 } |
381 | 381 |
382 } // namespace chromeos | 382 } // namespace chromeos |
OLD | NEW |