OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 ASSERT_NO_FATAL_FAILURE( | 24 ASSERT_NO_FATAL_FAILURE( |
25 registry_overrides_manager_.OverrideRegistry(HKEY_CURRENT_USER)); | 25 registry_overrides_manager_.OverrideRegistry(HKEY_CURRENT_USER)); |
26 ASSERT_FALSE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, | 26 ASSERT_FALSE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, |
27 base::string16()) | 27 base::string16()) |
28 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); | 28 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); |
29 } | 29 } |
30 | 30 |
31 void CreateNewRegistryValue(const base::string16& key_path, | 31 void CreateNewRegistryValue(const base::string16& key_path, |
32 const base::string16& name, | 32 const base::string16& name, |
33 const base::string16& value) { | 33 const base::string16& value) { |
34 ScopedVector<RegistryEntry> entries; | 34 std::vector<std::unique_ptr<RegistryEntry>> entries; |
35 entries.push_back(new RegistryEntry(key_path, name, value)); | 35 entries.push_back(base::MakeUnique<RegistryEntry>(key_path, name, value)); |
36 ASSERT_TRUE(ShellUtil::AddRegistryEntries(HKEY_CURRENT_USER, entries)); | 36 ASSERT_TRUE(ShellUtil::AddRegistryEntries(HKEY_CURRENT_USER, entries)); |
37 } | 37 } |
38 | 38 |
39 void CreateScopedUserProtocolEntryAndVerifyRegistryValue( | 39 void CreateScopedUserProtocolEntryAndVerifyRegistryValue( |
40 const base::string16& expected_entry_value) { | 40 const base::string16& expected_entry_value) { |
41 entry_ = base::MakeUnique<ScopedUserProtocolEntry>(L"http"); | 41 entry_ = base::MakeUnique<ScopedUserProtocolEntry>(L"http"); |
42 ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, | 42 ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, |
43 expected_entry_value) | 43 expected_entry_value) |
44 .ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); | 44 .ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); |
45 } | 45 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 TEST_F(ScopedUserProtocolEntryTest, KeyHasBeenDeletedByOthersTest) { | 119 TEST_F(ScopedUserProtocolEntryTest, KeyHasBeenDeletedByOthersTest) { |
120 CreateScopedUserProtocolEntryAndVerifyRegistryValue(base::string16()); | 120 CreateScopedUserProtocolEntryAndVerifyRegistryValue(base::string16()); |
121 base::win::RegKey key(HKEY_CURRENT_USER, L"", KEY_WRITE); | 121 base::win::RegKey key(HKEY_CURRENT_USER, L"", KEY_WRITE); |
122 EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(kProtocolEntryKeyPath)); | 122 EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(kProtocolEntryKeyPath)); |
123 entry_.reset(); | 123 entry_.reset(); |
124 ASSERT_FALSE( | 124 ASSERT_FALSE( |
125 RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, base::string16()) | 125 RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, base::string16()) |
126 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); | 126 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); |
127 } | 127 } |
OLD | NEW |