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

Side by Side Diff: chrome/installer/mini_installer/configuration_test.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/mini_installer/configuration.h" 5 #include "chrome/installer/mini_installer/configuration.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 private: 47 private:
48 DISALLOW_COPY_AND_ASSIGN(TestConfiguration); 48 DISALLOW_COPY_AND_ASSIGN(TestConfiguration);
49 }; 49 };
50 50
51 } // namespace 51 } // namespace
52 52
53 class MiniInstallerConfigurationTest : public ::testing::Test { 53 class MiniInstallerConfigurationTest : public ::testing::Test {
54 protected: 54 protected:
55 MiniInstallerConfigurationTest() { 55 MiniInstallerConfigurationTest() = default;
56 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER); 56
57 registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE); 57 void SetUp() override {
58 ASSERT_NO_FATAL_FAILURE(
59 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER));
60 ASSERT_NO_FATAL_FAILURE(
61 registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE));
58 } 62 }
59 63
60 // Adds sufficient state in the registry for Configuration to think that 64 // Adds sufficient state in the registry for Configuration to think that
61 // Chrome is already installed at |system_level| as per |multi_install|. 65 // Chrome is already installed at |system_level| as per |multi_install|.
62 void AddChromeRegistryState(bool system_level, bool multi_install) { 66 void AddChromeRegistryState(bool system_level, bool multi_install) {
63 #if defined(GOOGLE_CHROME_BUILD) 67 #if defined(GOOGLE_CHROME_BUILD)
64 static constexpr wchar_t kClientsPath[] = 68 static constexpr wchar_t kClientsPath[] =
65 L"SOFTWARE\\Google\\Update\\Clients\\" 69 L"SOFTWARE\\Google\\Update\\Clients\\"
66 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; 70 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
67 static constexpr wchar_t kClientStatePath[] = 71 static constexpr wchar_t kClientStatePath[] =
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 199 }
196 } 200 }
197 201
198 TEST_F(MiniInstallerConfigurationTest, HasInvalidSwitch) { 202 TEST_F(MiniInstallerConfigurationTest, HasInvalidSwitch) {
199 EXPECT_FALSE(TestConfiguration(L"spam.exe").has_invalid_switch()); 203 EXPECT_FALSE(TestConfiguration(L"spam.exe").has_invalid_switch());
200 EXPECT_TRUE(TestConfiguration(L"spam.exe --chrome-frame") 204 EXPECT_TRUE(TestConfiguration(L"spam.exe --chrome-frame")
201 .has_invalid_switch()); 205 .has_invalid_switch());
202 } 206 }
203 207
204 } // namespace mini_installer 208 } // namespace mini_installer
OLDNEW
« no previous file with comments | « chrome/installer/gcapi/gcapi_test_registry_overrider.cc ('k') | chrome/installer/setup/installer_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698