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

Unified Diff: chrome/browser/supervised_user/supervised_user_bookmarks_handler_unittest.cc

Issue 2843813002: Remove SetWithoutPathExpansion (Closed)
Patch Set: Fix CrOS Error Created 3 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/supervised_user/supervised_user_bookmarks_handler_unittest.cc
diff --git a/chrome/browser/supervised_user/supervised_user_bookmarks_handler_unittest.cc b/chrome/browser/supervised_user/supervised_user_bookmarks_handler_unittest.cc
index 057fab1eebda47e5d6ab43881f701bae33b20308..f2e5cd3501b9fd7b208cbffe260b2af69c9094bd 100644
--- a/chrome/browser/supervised_user/supervised_user_bookmarks_handler_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_bookmarks_handler_unittest.cc
@@ -10,6 +10,7 @@
#include <map>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include "base/json/json_reader.h"
@@ -195,49 +196,55 @@ std::ostream& operator<<(std::ostream& str, const Link& link) {
class SupervisedUserBookmarksHandlerTest : public ::testing::Test {
protected:
- static base::DictionaryValue* CreateSettings(base::DictionaryValue* links,
- base::DictionaryValue* folders) {
- base::DictionaryValue* settings = new base::DictionaryValue;
+ static std::unique_ptr<base::DictionaryValue> CreateSettings(
+ std::unique_ptr<base::DictionaryValue> links,
+ std::unique_ptr<base::DictionaryValue> folders) {
+ auto settings = base::MakeUnique<base::DictionaryValue>();
settings->SetStringWithoutPathExpansion("some_setting", "bleh");
- settings->SetWithoutPathExpansion("SupervisedBookmarkLink", links);
+ settings->SetWithoutPathExpansion("SupervisedBookmarkLink",
+ std::move(links));
settings->SetStringWithoutPathExpansion("some_other_setting", "foo");
- settings->SetWithoutPathExpansion("SupervisedBookmarkFolder", folders);
+ settings->SetWithoutPathExpansion("SupervisedBookmarkFolder",
+ std::move(folders));
settings->SetStringWithoutPathExpansion("another_one", "blurb");
return settings;
}
- static base::DictionaryValue* CreateDictionary(const Setting* begin,
- const Setting* end) {
- base::DictionaryValue* dict = new base::DictionaryValue;
+ static std::unique_ptr<base::DictionaryValue> CreateDictionary(
+ const Setting* begin,
+ const Setting* end) {
+ auto dict = base::MakeUnique<base::DictionaryValue>();
for (const Setting* setting = begin; setting != end; ++setting)
dict->SetStringWithoutPathExpansion(setting->first, setting->second);
return dict;
}
- static base::DictionaryValue* CreateLinkDictionary() {
+ static std::unique_ptr<base::DictionaryValue> CreateLinkDictionary() {
return CreateDictionary(LINK_SETTINGS,
LINK_SETTINGS + arraysize(LINK_SETTINGS));
}
- static base::DictionaryValue* CreateLinkDictionaryWithInvalidParents() {
+ static std::unique_ptr<base::DictionaryValue>
+ CreateLinkDictionaryWithInvalidParents() {
return CreateDictionary(
LINK_SETTINGS_INVALID_PARENT,
LINK_SETTINGS_INVALID_PARENT + arraysize(LINK_SETTINGS_INVALID_PARENT));
}
- static base::DictionaryValue* CreateFolderDictionary() {
+ static std::unique_ptr<base::DictionaryValue> CreateFolderDictionary() {
return CreateDictionary(FOLDER_SETTINGS,
FOLDER_SETTINGS + arraysize(FOLDER_SETTINGS));
}
- static base::DictionaryValue* CreateFolderDictionaryWithInvalidParents() {
- return CreateDictionary(
- FOLDER_SETTINGS_INVALID_PARENT,
- FOLDER_SETTINGS_INVALID_PARENT +
- arraysize(FOLDER_SETTINGS_INVALID_PARENT));
+ static std::unique_ptr<base::DictionaryValue>
+ CreateFolderDictionaryWithInvalidParents() {
+ return CreateDictionary(FOLDER_SETTINGS_INVALID_PARENT,
+ FOLDER_SETTINGS_INVALID_PARENT +
+ arraysize(FOLDER_SETTINGS_INVALID_PARENT));
}
- static base::DictionaryValue* CreateFolderDictionaryWithCircle() {
+ static std::unique_ptr<base::DictionaryValue>
+ CreateFolderDictionaryWithCircle() {
return CreateDictionary(
FOLDER_SETTINGS_CIRCLE,
FOLDER_SETTINGS_CIRCLE + arraysize(FOLDER_SETTINGS_CIRCLE));

Powered by Google App Engine
This is Rietveld 408576698