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

Side by Side Diff: chromeos/dbus/shill_client_unittest_base.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweaks Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chromeos/network/shill_property_util.h" 10 #include "chromeos/network/shill_property_util.h"
(...skipping 20 matching lines...) Expand all
31 return NULL; 31 return NULL;
32 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); 32 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
33 while (array_reader.HasMoreData()) { 33 while (array_reader.HasMoreData()) {
34 dbus::MessageReader entry_reader(NULL); 34 dbus::MessageReader entry_reader(NULL);
35 std::string key; 35 std::string key;
36 std::string value; 36 std::string value;
37 if (!array_reader.PopDictEntry(&entry_reader) || 37 if (!array_reader.PopDictEntry(&entry_reader) ||
38 !entry_reader.PopString(&key) || 38 !entry_reader.PopString(&key) ||
39 !entry_reader.PopString(&value)) 39 !entry_reader.PopString(&value))
40 return NULL; 40 return NULL;
41 result->SetWithoutPathExpansion(key, base::Value::CreateStringValue(value)); 41 result->SetWithoutPathExpansion(key, new base::StringValue(value));
42 } 42 }
43 return result.release(); 43 return result.release();
44 } 44 }
45 45
46 } // namespace 46 } // namespace
47 47
48 ValueMatcher::ValueMatcher(const base::Value& value) 48 ValueMatcher::ValueMatcher(const base::Value& value)
49 : expected_value_(value.DeepCopy()) {} 49 : expected_value_(value.DeepCopy()) {}
50 50
51 bool ValueMatcher::MatchAndExplain(const base::Value& value, 51 bool ValueMatcher::MatchAndExplain(const base::Value& value,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 EXPECT_TRUE(value->Equals(expected_value)); 275 EXPECT_TRUE(value->Equals(expected_value));
276 } 276 }
277 } 277 }
278 278
279 // static 279 // static
280 base::DictionaryValue* 280 base::DictionaryValue*
281 ShillClientUnittestBase::CreateExampleServiceProperties() { 281 ShillClientUnittestBase::CreateExampleServiceProperties() {
282 base::DictionaryValue* properties = new base::DictionaryValue; 282 base::DictionaryValue* properties = new base::DictionaryValue;
283 properties->SetWithoutPathExpansion( 283 properties->SetWithoutPathExpansion(
284 shill::kGuidProperty, 284 shill::kGuidProperty,
285 base::Value::CreateStringValue("00000000-0000-0000-0000-000000000000")); 285 new base::StringValue("00000000-0000-0000-0000-000000000000"));
286 properties->SetWithoutPathExpansion( 286 properties->SetWithoutPathExpansion(
287 shill::kModeProperty, 287 shill::kModeProperty, new base::StringValue(shill::kModeManaged));
288 base::Value::CreateStringValue(shill::kModeManaged)); 288 properties->SetWithoutPathExpansion(shill::kTypeProperty,
289 properties->SetWithoutPathExpansion( 289 new base::StringValue(shill::kTypeWifi));
290 shill::kTypeProperty,
291 base::Value::CreateStringValue(shill::kTypeWifi));
292 shill_property_util::SetSSID("testssid", properties); 290 shill_property_util::SetSSID("testssid", properties);
293 properties->SetWithoutPathExpansion( 291 properties->SetWithoutPathExpansion(
294 shill::kSecurityProperty, 292 shill::kSecurityProperty, new base::StringValue(shill::kSecurityPsk));
295 base::Value::CreateStringValue(shill::kSecurityPsk));
296 return properties; 293 return properties;
297 } 294 }
298 295
299 296
300 // static 297 // static
301 void ShillClientUnittestBase::ExpectNoResultValue( 298 void ShillClientUnittestBase::ExpectNoResultValue(
302 DBusMethodCallStatus call_status) { 299 DBusMethodCallStatus call_status) {
303 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); 300 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status);
304 } 301 }
305 302
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 378
382 void ShillClientUnittestBase::OnCallMethodWithErrorCallback( 379 void ShillClientUnittestBase::OnCallMethodWithErrorCallback(
383 dbus::MethodCall* method_call, 380 dbus::MethodCall* method_call,
384 int timeout_ms, 381 int timeout_ms,
385 const dbus::ObjectProxy::ResponseCallback& response_callback, 382 const dbus::ObjectProxy::ResponseCallback& response_callback,
386 const dbus::ObjectProxy::ErrorCallback& error_callback) { 383 const dbus::ObjectProxy::ErrorCallback& error_callback) {
387 OnCallMethod(method_call, timeout_ms, response_callback); 384 OnCallMethod(method_call, timeout_ms, response_callback);
388 } 385 }
389 386
390 } // namespace chromeos 387 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698