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

Unified Diff: extensions/browser/api_test_utils.cc

Issue 1308013005: Add scoped_ptr-safe base::Value to Dictionary/List conversion functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made conversions static members. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api_test_utils.cc
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc
index 587f8e298098bc6c8a521a82ad6882d1f7df9ccb..47bcb0e623abb10b50ed3f45d343c4e7b29fb1f3 100644
--- a/extensions/browser/api_test_utils.cc
+++ b/extensions/browser/api_test_utils.cc
@@ -24,11 +24,7 @@ scoped_ptr<base::Value> ParseJSON(const std::string& data) {
}
scoped_ptr<base::ListValue> ParseList(const std::string& data) {
- scoped_ptr<base::Value> result = ParseJSON(data);
- scoped_ptr<base::ListValue> list_result;
- if (result->GetAsList(nullptr))
- list_result.reset(static_cast<base::ListValue*>(result.release()));
- return list_result;
+ return base::ListValue::From(ParseJSON(data));
}
// This helps us be able to wait until an UIThreadExtensionFunction calls
@@ -75,11 +71,7 @@ namespace extensions {
namespace api_test_utils {
scoped_ptr<base::DictionaryValue> ParseDictionary(const std::string& data) {
- scoped_ptr<base::Value> result = ParseJSON(data);
- scoped_ptr<base::DictionaryValue> dict_result;
- if (result->GetAsDictionary(nullptr))
- dict_result.reset(static_cast<base::DictionaryValue*>(result.release()));
- return dict_result;
+ return base::DictionaryValue::From(ParseJSON(data));
}
bool GetBoolean(const base::DictionaryValue* val, const std::string& key) {
« no previous file with comments | « extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc ('k') | extensions/common/extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698