Chromium Code Reviews| Index: chrome/browser/chromeos/file_system_provider/registry_unittest.cc |
| diff --git a/chrome/browser/chromeos/file_system_provider/registry_unittest.cc b/chrome/browser/chromeos/file_system_provider/registry_unittest.cc |
| index ef5c1e0fe3ef9e7c5a9c8aa02c3ebb43c3b838a3..3d7708d68a8f8d3794595f91f505f63c37d252a7 100644 |
| --- a/chrome/browser/chromeos/file_system_provider/registry_unittest.cc |
| +++ b/chrome/browser/chromeos/file_system_provider/registry_unittest.cc |
| @@ -6,9 +6,11 @@ |
| #include <memory> |
| #include <string> |
| +#include <utility> |
| #include <vector> |
| #include "base/files/file_path.h" |
| +#include "base/memory/ptr_util.h" |
| #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" |
| #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h" |
| #include "chrome/common/pref_names.h" |
| @@ -55,8 +57,8 @@ void RememberFakeFileSystem(TestingProfile* profile, |
| ASSERT_TRUE(pref_service); |
| base::DictionaryValue extensions; |
| - base::DictionaryValue* const file_systems = new base::DictionaryValue(); |
| - base::DictionaryValue* const file_system = new base::DictionaryValue(); |
| + auto file_systems = base::MakeUnique<base::DictionaryValue>(); |
|
jdoerrie
2017/04/06 14:25:49
Consider moving this down to where it's needed for
vabr (Chromium)
2017/04/07 20:40:39
Done.
|
| + auto file_system = base::MakeUnique<base::DictionaryValue>(); |
| file_system->SetStringWithoutPathExpansion(kPrefKeyFileSystemId, |
| kFileSystemId); |
| file_system->SetStringWithoutPathExpansion(kPrefKeyDisplayName, kDisplayName); |
| @@ -65,28 +67,29 @@ void RememberFakeFileSystem(TestingProfile* profile, |
| supports_notify_tag); |
| file_system->SetIntegerWithoutPathExpansion(kPrefKeyOpenedFilesLimit, |
| opened_files_limit); |
| - file_systems->SetWithoutPathExpansion(kFileSystemId, file_system); |
| - extensions.SetWithoutPathExpansion(kExtensionId, file_systems); |
| // Remember watchers. |
| - base::DictionaryValue* const watchers = new base::DictionaryValue(); |
| - file_system->SetWithoutPathExpansion(kPrefKeyWatchers, watchers); |
| - base::DictionaryValue* const watcher_value = new base::DictionaryValue(); |
| - watchers->SetWithoutPathExpansion(watcher.entry_path.value(), watcher_value); |
| + auto watchers = base::MakeUnique<base::DictionaryValue>(); |
|
jdoerrie
2017/04/06 14:25:49
Same here.
vabr (Chromium)
2017/04/07 20:40:39
Done.
|
| + auto watcher_value = base::MakeUnique<base::DictionaryValue>(); |
| watcher_value->SetStringWithoutPathExpansion(kPrefKeyWatcherEntryPath, |
| watcher.entry_path.value()); |
| watcher_value->SetBooleanWithoutPathExpansion(kPrefKeyWatcherRecursive, |
| watcher.recursive); |
| watcher_value->SetStringWithoutPathExpansion(kPrefKeyWatcherLastTag, |
| watcher.last_tag); |
| - base::ListValue* const persistent_origins_value = new base::ListValue(); |
| - watcher_value->SetWithoutPathExpansion(kPrefKeyWatcherPersistentOrigins, |
| - persistent_origins_value); |
| + auto persistent_origins_value = base::MakeUnique<base::ListValue>(); |
| for (const auto& subscriber_it : watcher.subscribers) { |
| if (subscriber_it.second.persistent) |
| persistent_origins_value->AppendString(subscriber_it.first.spec()); |
| } |
| + watcher_value->SetWithoutPathExpansion(kPrefKeyWatcherPersistentOrigins, |
| + std::move(persistent_origins_value)); |
| + watchers->SetWithoutPathExpansion(watcher.entry_path.value(), |
| + std::move(watcher_value)); |
| + file_system->SetWithoutPathExpansion(kPrefKeyWatchers, std::move(watchers)); |
| + file_systems->SetWithoutPathExpansion(kFileSystemId, std::move(file_system)); |
| + extensions.SetWithoutPathExpansion(kExtensionId, std::move(file_systems)); |
| pref_service->Set(prefs::kFileSystemProviderMounted, extensions); |
| } |