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

Unified Diff: extensions/browser/api_test_utils.cc

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
« no previous file with comments | « extensions/browser/api_test_utils.h ('k') | extensions/browser/api_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api_test_utils.cc
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc
index 7d5362423ebb052ef7e6b564193ee17cd6f00412..9d2983d5f7855c37ea5ce3f78a6c738a8a1e18ae 100644
--- a/extensions/browser/api_test_utils.cc
+++ b/extensions/browser/api_test_utils.cc
@@ -4,10 +4,10 @@
#include "extensions/browser/api_test_utils.h"
+#include <memory>
#include <utility>
#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h"
@@ -21,11 +21,11 @@ using extensions::ExtensionFunctionDispatcher;
namespace {
-scoped_ptr<base::Value> ParseJSON(const std::string& data) {
+std::unique_ptr<base::Value> ParseJSON(const std::string& data) {
return base::JSONReader::Read(data);
}
-scoped_ptr<base::ListValue> ParseList(const std::string& data) {
+std::unique_ptr<base::ListValue> ParseList(const std::string& data) {
return base::ListValue::From(ParseJSON(data));
}
@@ -62,7 +62,7 @@ class SendResponseDelegate
}
private:
- scoped_ptr<bool> response_;
+ std::unique_ptr<bool> response_;
bool should_post_quit_;
};
@@ -72,7 +72,8 @@ namespace extensions {
namespace api_test_utils {
-scoped_ptr<base::DictionaryValue> ParseDictionary(const std::string& data) {
+std::unique_ptr<base::DictionaryValue> ParseDictionary(
+ const std::string& data) {
return base::DictionaryValue::From(ParseJSON(data));
}
@@ -122,7 +123,7 @@ scoped_refptr<Extension> CreateExtension(
scoped_refptr<Extension> CreateEmptyExtensionWithLocation(
Manifest::Location location) {
- scoped_ptr<base::DictionaryValue> test_extension_value =
+ std::unique_ptr<base::DictionaryValue> test_extension_value =
ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}");
return CreateExtension(location, test_extension_value.get(), std::string());
}
@@ -131,7 +132,7 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) {
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) {
return RunFunctionWithDelegateAndReturnSingleResult(
function, args, context, std::move(dispatcher), NONE);
}
@@ -140,7 +141,7 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
RunFunctionFlags flags) {
scoped_refptr<ExtensionFunction> function_owner(function);
// Without a callback the function will not generate a result.
@@ -168,7 +169,7 @@ base::Value* RunFunctionAndReturnSingleResult(
const std::string& args,
content::BrowserContext* context,
RunFunctionFlags flags) {
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher(
new ExtensionFunctionDispatcher(context));
return RunFunctionWithDelegateAndReturnSingleResult(
@@ -185,7 +186,7 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
RunFunctionFlags flags) {
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher(
new ExtensionFunctionDispatcher(context));
scoped_refptr<ExtensionFunction> function_owner(function);
// Without a callback the function will not generate a result.
@@ -198,28 +199,30 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
bool RunFunction(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context) {
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher(
new ExtensionFunctionDispatcher(context));
return RunFunction(function, args, context, std::move(dispatcher), NONE);
}
-bool RunFunction(UIThreadExtensionFunction* function,
- const std::string& args,
- content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
- RunFunctionFlags flags) {
- scoped_ptr<base::ListValue> parsed_args = ParseList(args);
+bool RunFunction(
+ UIThreadExtensionFunction* function,
+ const std::string& args,
+ content::BrowserContext* context,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ RunFunctionFlags flags) {
+ std::unique_ptr<base::ListValue> parsed_args = ParseList(args);
EXPECT_TRUE(parsed_args.get())
<< "Could not parse extension function arguments: " << args;
return RunFunction(function, std::move(parsed_args), context,
std::move(dispatcher), flags);
}
-bool RunFunction(UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
- content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
- RunFunctionFlags flags) {
+bool RunFunction(
+ UIThreadExtensionFunction* function,
+ std::unique_ptr<base::ListValue> args,
+ content::BrowserContext* context,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ RunFunctionFlags flags) {
SendResponseDelegate response_delegate;
function->set_test_delegate(&response_delegate);
function->SetArgs(args.get());
« no previous file with comments | « extensions/browser/api_test_utils.h ('k') | extensions/browser/api_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698