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::StringValue(value)); | 45 result->SetWithoutPathExpansion(key, new base::Value(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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->SetWithoutPathExpansion( |
318 shill::kGuidProperty, | 318 shill::kGuidProperty, |
319 new base::StringValue("00000000-0000-0000-0000-000000000000")); | 319 new base::Value("00000000-0000-0000-0000-000000000000")); |
320 properties->SetWithoutPathExpansion( | 320 properties->SetWithoutPathExpansion(shill::kModeProperty, |
321 shill::kModeProperty, new base::StringValue(shill::kModeManaged)); | 321 new base::Value(shill::kModeManaged)); |
322 properties->SetWithoutPathExpansion(shill::kTypeProperty, | 322 properties->SetWithoutPathExpansion(shill::kTypeProperty, |
323 new base::StringValue(shill::kTypeWifi)); | 323 new base::Value(shill::kTypeWifi)); |
324 shill_property_util::SetSSID("testssid", properties); | 324 shill_property_util::SetSSID("testssid", properties); |
325 properties->SetWithoutPathExpansion( | 325 properties->SetWithoutPathExpansion(shill::kSecurityClassProperty, |
326 shill::kSecurityClassProperty, | 326 new base::Value(shill::kSecurityPsk)); |
327 new base::StringValue(shill::kSecurityPsk)); | |
328 return properties; | 327 return properties; |
329 } | 328 } |
330 | 329 |
331 | 330 |
332 // static | 331 // static |
333 void ShillClientUnittestBase::ExpectNoResultValue( | 332 void ShillClientUnittestBase::ExpectNoResultValue( |
334 DBusMethodCallStatus call_status) { | 333 DBusMethodCallStatus call_status) { |
335 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); | 334 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); |
336 } | 335 } |
337 | 336 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 434 |
436 void ShillClientUnittestBase::OnCallMethodWithErrorCallback( | 435 void ShillClientUnittestBase::OnCallMethodWithErrorCallback( |
437 dbus::MethodCall* method_call, | 436 dbus::MethodCall* method_call, |
438 int timeout_ms, | 437 int timeout_ms, |
439 const dbus::ObjectProxy::ResponseCallback& response_callback, | 438 const dbus::ObjectProxy::ResponseCallback& response_callback, |
440 const dbus::ObjectProxy::ErrorCallback& error_callback) { | 439 const dbus::ObjectProxy::ErrorCallback& error_callback) { |
441 OnCallMethod(method_call, timeout_ms, response_callback); | 440 OnCallMethod(method_call, timeout_ms, response_callback); |
442 } | 441 } |
443 | 442 |
444 } // namespace chromeos | 443 } // namespace chromeos |
OLD | NEW |