| 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 "chromeos/dbus/shill_client_unittest_base.h" | 5 #include "chromeos/dbus/shill_client_unittest_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return NULL; | 35 return NULL; |
| 36 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 36 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
| 37 while (array_reader.HasMoreData()) { | 37 while (array_reader.HasMoreData()) { |
| 38 dbus::MessageReader entry_reader(NULL); | 38 dbus::MessageReader entry_reader(NULL); |
| 39 std::string key; | 39 std::string key; |
| 40 std::string value; | 40 std::string value; |
| 41 if (!array_reader.PopDictEntry(&entry_reader) || | 41 if (!array_reader.PopDictEntry(&entry_reader) || |
| 42 !entry_reader.PopString(&key) || | 42 !entry_reader.PopString(&key) || |
| 43 !entry_reader.PopString(&value)) | 43 !entry_reader.PopString(&value)) |
| 44 return NULL; | 44 return NULL; |
| 45 result->SetWithoutPathExpansion(key, new base::Value(value)); | 45 result->SetStringWithoutPathExpansion(key, value); |
| 46 } | 46 } |
| 47 return result.release(); | 47 return result.release(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 ValueMatcher::ValueMatcher(const base::Value& value) | 52 ValueMatcher::ValueMatcher(const base::Value& value) |
| 53 : expected_value_(value.DeepCopy()) {} | 53 : expected_value_(value.DeepCopy()) {} |
| 54 | 54 |
| 55 bool ValueMatcher::MatchAndExplain(const base::Value& value, | 55 bool ValueMatcher::MatchAndExplain(const base::Value& value, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 EXPECT_TRUE(expected_dictionary->GetWithoutPathExpansion(key, | 307 EXPECT_TRUE(expected_dictionary->GetWithoutPathExpansion(key, |
| 308 &expected_value)); | 308 &expected_value)); |
| 309 EXPECT_TRUE(value->Equals(expected_value)); | 309 EXPECT_TRUE(value->Equals(expected_value)); |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 | 312 |
| 313 // static | 313 // static |
| 314 base::DictionaryValue* | 314 base::DictionaryValue* |
| 315 ShillClientUnittestBase::CreateExampleServiceProperties() { | 315 ShillClientUnittestBase::CreateExampleServiceProperties() { |
| 316 base::DictionaryValue* properties = new base::DictionaryValue; | 316 base::DictionaryValue* properties = new base::DictionaryValue; |
| 317 properties->SetWithoutPathExpansion( | 317 properties->SetStringWithoutPathExpansion( |
| 318 shill::kGuidProperty, | 318 shill::kGuidProperty, "00000000-0000-0000-0000-000000000000"); |
| 319 new base::Value("00000000-0000-0000-0000-000000000000")); | 319 properties->SetStringWithoutPathExpansion(shill::kModeProperty, |
| 320 properties->SetWithoutPathExpansion(shill::kModeProperty, | 320 shill::kModeManaged); |
| 321 new base::Value(shill::kModeManaged)); | 321 properties->SetStringWithoutPathExpansion(shill::kTypeProperty, |
| 322 properties->SetWithoutPathExpansion(shill::kTypeProperty, | 322 shill::kTypeWifi); |
| 323 new base::Value(shill::kTypeWifi)); | |
| 324 shill_property_util::SetSSID("testssid", properties); | 323 shill_property_util::SetSSID("testssid", properties); |
| 325 properties->SetWithoutPathExpansion(shill::kSecurityClassProperty, | 324 properties->SetStringWithoutPathExpansion(shill::kSecurityClassProperty, |
| 326 new base::Value(shill::kSecurityPsk)); | 325 shill::kSecurityPsk); |
| 327 return properties; | 326 return properties; |
| 328 } | 327 } |
| 329 | 328 |
| 330 | 329 |
| 331 // static | 330 // static |
| 332 void ShillClientUnittestBase::ExpectNoResultValue( | 331 void ShillClientUnittestBase::ExpectNoResultValue( |
| 333 DBusMethodCallStatus call_status) { | 332 DBusMethodCallStatus call_status) { |
| 334 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); | 333 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); |
| 335 } | 334 } |
| 336 | 335 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 433 |
| 435 void ShillClientUnittestBase::OnCallMethodWithErrorCallback( | 434 void ShillClientUnittestBase::OnCallMethodWithErrorCallback( |
| 436 dbus::MethodCall* method_call, | 435 dbus::MethodCall* method_call, |
| 437 int timeout_ms, | 436 int timeout_ms, |
| 438 const dbus::ObjectProxy::ResponseCallback& response_callback, | 437 const dbus::ObjectProxy::ResponseCallback& response_callback, |
| 439 const dbus::ObjectProxy::ErrorCallback& error_callback) { | 438 const dbus::ObjectProxy::ErrorCallback& error_callback) { |
| 440 OnCallMethod(method_call, timeout_ms, response_callback); | 439 OnCallMethod(method_call, timeout_ms, response_callback); |
| 441 } | 440 } |
| 442 | 441 |
| 443 } // namespace chromeos | 442 } // namespace chromeos |
| OLD | NEW |