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

Side by Side Diff: chrome/installer/util/scoped_user_protocol_entry_unittest.cc

Issue 2341693002: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Change std::string() back to "" to fix compile 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/util/scoped_user_protocol_entry.h" 5 #include "chrome/installer/util/scoped_user_protocol_entry.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/test/test_reg_util_win.h" 9 #include "base/test/test_reg_util_win.h"
10 #include "base/win/registry.h" 10 #include "base/win/registry.h"
(...skipping 19 matching lines...) Expand all
30 void CreateNewRegistryValue(const base::string16& key_path, 30 void CreateNewRegistryValue(const base::string16& key_path,
31 const base::string16& name, 31 const base::string16& name,
32 const base::string16& value) { 32 const base::string16& value) {
33 ScopedVector<RegistryEntry> entries; 33 ScopedVector<RegistryEntry> entries;
34 entries.push_back(new RegistryEntry(key_path, name, value)); 34 entries.push_back(new RegistryEntry(key_path, name, value));
35 ASSERT_TRUE(ShellUtil::AddRegistryEntries(HKEY_CURRENT_USER, entries)); 35 ASSERT_TRUE(ShellUtil::AddRegistryEntries(HKEY_CURRENT_USER, entries));
36 } 36 }
37 37
38 void CreateScopedUserProtocolEntryAndVerifyRegistryValue( 38 void CreateScopedUserProtocolEntryAndVerifyRegistryValue(
39 const base::string16& expected_entry_value) { 39 const base::string16& expected_entry_value) {
40 entry_ = base::WrapUnique(new ScopedUserProtocolEntry(L"http")); 40 entry_ = base::MakeUnique<ScopedUserProtocolEntry>(L"http");
41 ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, 41 ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName,
42 expected_entry_value) 42 expected_entry_value)
43 .ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); 43 .ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU));
44 } 44 }
45 45
46 registry_util::RegistryOverrideManager registry_overrides_manager_; 46 registry_util::RegistryOverrideManager registry_overrides_manager_;
47 std::unique_ptr<ScopedUserProtocolEntry> entry_; 47 std::unique_ptr<ScopedUserProtocolEntry> entry_;
48 }; 48 };
49 49
50 const wchar_t ScopedUserProtocolEntryTest::kProtocolEntryKeyPath[] = 50 const wchar_t ScopedUserProtocolEntryTest::kProtocolEntryKeyPath[] =
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 TEST_F(ScopedUserProtocolEntryTest, KeyHasBeenDeletedByOthersTest) { 118 TEST_F(ScopedUserProtocolEntryTest, KeyHasBeenDeletedByOthersTest) {
119 CreateScopedUserProtocolEntryAndVerifyRegistryValue(base::string16()); 119 CreateScopedUserProtocolEntryAndVerifyRegistryValue(base::string16());
120 base::win::RegKey key(HKEY_CURRENT_USER, L"", KEY_WRITE); 120 base::win::RegKey key(HKEY_CURRENT_USER, L"", KEY_WRITE);
121 EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(kProtocolEntryKeyPath)); 121 EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(kProtocolEntryKeyPath));
122 entry_.reset(); 122 entry_.reset();
123 ASSERT_FALSE( 123 ASSERT_FALSE(
124 RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, base::string16()) 124 RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, base::string16())
125 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); 125 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU));
126 } 126 }
OLDNEW
« no previous file with comments | « chrome/installer/util/lzma_file_allocator_unittest.cc ('k') | chrome/renderer/extensions/extension_localization_peer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698