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

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

Issue 2323993004: Remove use of deprecated base::ListValue::Append(Value*) overload in extensions. (Closed)
Patch Set: ... I hate C++ Created 4 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: 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 52639e12c40e9c9d6dd5b88b67153dd882d6a964..5961e214069fe66d844bb892aca1895c613b8d08 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
@@ -115,7 +115,7 @@ bool DeveloperPrivateApiUnitTest::RunFunction(
const scoped_refptr<UIThreadExtensionFunction>& function,
const base::ListValue& args) {
return extension_function_test_utils::RunFunction(
- function.get(), base::WrapUnique(args.DeepCopy()), browser(),
+ function.get(), args.CreateDeepCopy(), browser(),
extension_function_test_utils::NONE);
}
@@ -178,27 +178,37 @@ void DeveloperPrivateApiUnitTest::TestExtensionPrefSetting(
scoped_refptr<UIThreadExtensionFunction> function(
new api::DeveloperPrivateUpdateExtensionConfigurationFunction());
- base::ListValue args;
- base::DictionaryValue* parameters = new base::DictionaryValue();
- parameters->SetString("extensionId", extension_id);
- parameters->SetBoolean(key, true);
- args.Append(parameters);
-
EXPECT_FALSE(has_pref.Run()) << key;
- EXPECT_FALSE(RunFunction(function, args)) << key;
- EXPECT_EQ(std::string("This action requires a user gesture."),
- function->GetError());
+ {
+ auto parameters = base::MakeUnique<base::DictionaryValue>();
+ parameters->SetString("extensionId", extension_id);
+ parameters->SetBoolean(key, true);
- ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture;
- function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction();
- EXPECT_TRUE(RunFunction(function, args)) << key;
- EXPECT_TRUE(has_pref.Run()) << key;
+ base::ListValue args;
+ args.Append(std::move(parameters));
+ EXPECT_FALSE(RunFunction(function, args)) << key;
+ EXPECT_EQ("This action requires a user gesture.", function->GetError());
- parameters->SetBoolean(key, false);
- function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction();
- EXPECT_TRUE(RunFunction(function, args)) << key;
- EXPECT_FALSE(has_pref.Run()) << key;
+ ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture;
+ function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction();
+ EXPECT_TRUE(RunFunction(function, args)) << key;
+ EXPECT_TRUE(has_pref.Run()) << key;
+ }
+
+ {
+ auto parameters = base::MakeUnique<base::DictionaryValue>();
+ parameters->SetString("extensionId", extension_id);
+ parameters->SetBoolean(key, false);
+
+ base::ListValue args;
+ args.Append(std::move(parameters));
+
+ ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture;
+ function = new api::DeveloperPrivateUpdateExtensionConfigurationFunction();
+ EXPECT_TRUE(RunFunction(function, args)) << key;
+ EXPECT_FALSE(has_pref.Run()) << key;
+ }
}
testing::AssertionResult DeveloperPrivateApiUnitTest::TestPackExtensionFunction(
« no previous file with comments | « chrome/browser/extensions/api/debugger/debugger_api.cc ('k') | chrome/browser/extensions/api/downloads/downloads_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698