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

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

Issue 2692843002: Fail tests fast if overriding the Windows registry fails. (Closed)
Patch Set: sync to position 450085 Created 3 years, 10 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"
11 #include "chrome/installer/util/registry_entry.h" 11 #include "chrome/installer/util/registry_entry.h"
12 #include "chrome/installer/util/shell_util.h" 12 #include "chrome/installer/util/shell_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 class ScopedUserProtocolEntryTest : public testing::Test { 15 class ScopedUserProtocolEntryTest : public testing::Test {
16 protected: 16 protected:
17 static const wchar_t kProtocolEntryKeyPath[]; 17 static const wchar_t kProtocolEntryKeyPath[];
18 static const wchar_t kProtocolEntrySubKeyPath[]; 18 static const wchar_t kProtocolEntrySubKeyPath[];
19 static const wchar_t kProtocolEntryName[]; 19 static const wchar_t kProtocolEntryName[];
20 static const wchar_t kProtocolEntryFakeName[]; 20 static const wchar_t kProtocolEntryFakeName[];
21 static const wchar_t kProtocolEntryFakeValue[]; 21 static const wchar_t kProtocolEntryFakeValue[];
22 22
23 void SetUp() override { 23 void SetUp() override {
24 registry_overrides_manager_.OverrideRegistry(HKEY_CURRENT_USER); 24 ASSERT_NO_FATAL_FAILURE(
25 registry_overrides_manager_.OverrideRegistry(HKEY_CURRENT_USER));
25 ASSERT_FALSE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, 26 ASSERT_FALSE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName,
26 base::string16()) 27 base::string16())
27 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); 28 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU));
28 } 29 }
29 30
30 void CreateNewRegistryValue(const base::string16& key_path, 31 void CreateNewRegistryValue(const base::string16& key_path,
31 const base::string16& name, 32 const base::string16& name,
32 const base::string16& value) { 33 const base::string16& value) {
33 ScopedVector<RegistryEntry> entries; 34 ScopedVector<RegistryEntry> entries;
34 entries.push_back(new RegistryEntry(key_path, name, value)); 35 entries.push_back(new RegistryEntry(key_path, name, value));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 118
118 TEST_F(ScopedUserProtocolEntryTest, KeyHasBeenDeletedByOthersTest) { 119 TEST_F(ScopedUserProtocolEntryTest, KeyHasBeenDeletedByOthersTest) {
119 CreateScopedUserProtocolEntryAndVerifyRegistryValue(base::string16()); 120 CreateScopedUserProtocolEntryAndVerifyRegistryValue(base::string16());
120 base::win::RegKey key(HKEY_CURRENT_USER, L"", KEY_WRITE); 121 base::win::RegKey key(HKEY_CURRENT_USER, L"", KEY_WRITE);
121 EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(kProtocolEntryKeyPath)); 122 EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(kProtocolEntryKeyPath));
122 entry_.reset(); 123 entry_.reset();
123 ASSERT_FALSE( 124 ASSERT_FALSE(
124 RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, base::string16()) 125 RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, base::string16())
125 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); 126 .KeyExistsInRegistry(RegistryEntry::LOOK_IN_HKCU));
126 } 127 }
OLDNEW
« no previous file with comments | « chrome/installer/util/product_unittest.cc ('k') | chrome/installer/util/set_reg_value_work_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698