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

Unified Diff: chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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
Index: chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
index b11f6453776328158f0c8d1e684d60edae0c459a..6636b6059a9a7c331669c5ae64c363d1125d6731 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/developer_private/developer_private_api.h"
+
+#include <memory>
#include <utility>
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/extensions/api/developer_private/developer_private_api.h"
#include "chrome/browser/extensions/error_console/error_console.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -41,12 +43,13 @@ namespace extensions {
namespace {
-scoped_ptr<KeyedService> BuildAPI(content::BrowserContext* context) {
- return make_scoped_ptr(new DeveloperPrivateAPI(context));
+std::unique_ptr<KeyedService> BuildAPI(content::BrowserContext* context) {
+ return base::WrapUnique(new DeveloperPrivateAPI(context));
}
-scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* profile) {
- return make_scoped_ptr(
+std::unique_ptr<KeyedService> BuildEventRouter(
+ content::BrowserContext* profile) {
+ return base::WrapUnique(
new EventRouter(profile, ExtensionPrefs::Get(profile)));
}
@@ -89,8 +92,8 @@ class DeveloperPrivateApiUnitTest : public ExtensionServiceTestBase {
void TearDown() override;
// The browser (and accompanying window).
- scoped_ptr<TestBrowserWindow> browser_window_;
- scoped_ptr<Browser> browser_;
+ std::unique_ptr<TestBrowserWindow> browser_window_;
+ std::unique_ptr<Browser> browser_;
ScopedVector<TestExtensionDir> test_extension_dirs_;
@@ -101,9 +104,7 @@ bool DeveloperPrivateApiUnitTest::RunFunction(
const scoped_refptr<UIThreadExtensionFunction>& function,
const base::ListValue& args) {
return extension_function_test_utils::RunFunction(
- function.get(),
- make_scoped_ptr(args.DeepCopy()),
- browser(),
+ function.get(), base::WrapUnique(args.DeepCopy()), browser(),
extension_function_test_utils::NONE);
}
@@ -202,7 +203,7 @@ testing::AssertionResult DeveloperPrivateApiUnitTest::TestPackExtensionFunction(
// part of the general extension api system.
const base::Value* response_value = nullptr;
CHECK(function->GetResultList()->Get(0u, &response_value));
- scoped_ptr<api::developer_private::PackDirectoryResponse> response =
+ std::unique_ptr<api::developer_private::PackDirectoryResponse> response =
api::developer_private::PackDirectoryResponse::FromValue(*response_value);
CHECK(response);
@@ -404,7 +405,7 @@ TEST_F(DeveloperPrivateApiUnitTest, DISABLED_DeveloperPrivateLoadUnpacked) {
function = new api::DeveloperPrivateLoadUnpackedFunction();
function->SetRenderFrameHost(web_contents->GetMainFrame());
base::ListValue unpacked_args;
- scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue());
options->SetBoolean("failQuietly", true);
unpacked_args.Append(options.release());
current_ids = registry()->enabled_extensions().GetIDs();
@@ -440,7 +441,7 @@ TEST_F(DeveloperPrivateApiUnitTest,
const base::Value* response_value = nullptr;
ASSERT_TRUE(function->GetResultList()->Get(0u, &response_value));
- scoped_ptr<api::developer_private::RequestFileSourceResponse> response =
+ std::unique_ptr<api::developer_private::RequestFileSourceResponse> response =
api::developer_private::RequestFileSourceResponse::FromValue(
*response_value);
EXPECT_FALSE(response->before_highlight.empty());
@@ -471,7 +472,7 @@ TEST_F(DeveloperPrivateApiUnitTest,
ASSERT_EQ(1u, list->GetSize());
const base::Value* value = nullptr;
ASSERT_TRUE(list->Get(0u, &value));
- scoped_ptr<api::developer_private::ExtensionInfo> info =
+ std::unique_ptr<api::developer_private::ExtensionInfo> info =
api::developer_private::ExtensionInfo::FromValue(*value);
ASSERT_TRUE(info);
@@ -487,7 +488,7 @@ TEST_F(DeveloperPrivateApiUnitTest,
ASSERT_TRUE(results->GetList(0u, &list));
ASSERT_EQ(1u, list->GetSize());
ASSERT_TRUE(list->Get(0u, &value));
- scoped_ptr<api::developer_private::ItemInfo> item_info =
+ std::unique_ptr<api::developer_private::ItemInfo> item_info =
api::developer_private::ItemInfo::FromValue(*value);
ASSERT_TRUE(item_info);
}
@@ -513,7 +514,7 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) {
// Start by removing all errors for the extension of a given type (manifest).
std::string type_string = api::developer_private::ToString(
api::developer_private::ERROR_TYPE_MANIFEST);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
ListBuilder()
.Append(DictionaryBuilder()
.Set("extensionId", extension->id())

Powered by Google App Engine
This is Rietveld 408576698