OLD | NEW |
---|---|
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/win/scoped_handle.h" | 8 #include "base/win/scoped_handle.h" |
9 #include "chrome/installer/util/browser_distribution.h" | 9 #include "chrome/installer/util/browser_distribution.h" |
10 #include "chrome/installer/util/google_update_constants.h" | 10 #include "chrome/installer/util/google_update_constants.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 EXPECT_TRUE(current_version->Equals(*found_version)); | 130 EXPECT_TRUE(current_version->Equals(*found_version)); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 namespace { | 136 namespace { |
137 bool SetUninstallArguments(HKEY root, BrowserDistribution* dist, | 137 bool SetUninstallArguments(HKEY root, BrowserDistribution* dist, |
138 const CommandLine& args) { | 138 const CommandLine& args) { |
139 RegKey key(root, dist->GetStateKey().c_str(), KEY_ALL_ACCESS); | 139 RegKey key(root, dist->GetStateKey().c_str(), KEY_ALL_ACCESS); |
140 return key.WriteValue(installer::kUninstallArgumentsField, | 140 return (key.WriteValue(installer::kUninstallArgumentsField, |
141 args.command_line_string().c_str()); | 141 args.command_line_string().c_str()) == ERROR_SUCCESS); |
142 } | 142 } |
143 | 143 |
144 bool SetInstalledVersion(HKEY root, BrowserDistribution* dist, | 144 bool SetInstalledVersion(HKEY root, BrowserDistribution* dist, |
145 const std::wstring& version) { | 145 const std::wstring& version) { |
146 RegKey key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS); | 146 RegKey key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS); |
147 return key.WriteValue(google_update::kRegVersionField, version.c_str()); | 147 return (key.WriteValue(google_update::kRegVersionField, version.c_str()) |
148 == ERROR_SUCCESS); | |
grt (UTC plus 2)
2011/01/16 04:19:48
Wrapping and indentation
| |
148 } | 149 } |
149 } // end namespace | 150 } // end namespace |
150 | 151 |
151 TEST_F(PackageTest, Dependency) { | 152 TEST_F(PackageTest, Dependency) { |
152 const bool multi_install = false; | 153 const bool multi_install = false; |
153 const bool system_level = true; | 154 const bool system_level = true; |
154 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 155 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
155 TempRegKeyOverride override(root, L"root_dep"); | 156 TempRegKeyOverride override(root, L"root_dep"); |
156 | 157 |
157 ChromePackageProperties properties; | 158 ChromePackageProperties properties; |
(...skipping 22 matching lines...) Expand all Loading... | |
180 | 181 |
181 // "install" Chrome Frame without multi-install. | 182 // "install" Chrome Frame without multi-install. |
182 SetUninstallArguments(root, cf, single_uninstall_cmd); | 183 SetUninstallArguments(root, cf, single_uninstall_cmd); |
183 SetInstalledVersion(root, cf, L"1.2.3.4"); | 184 SetInstalledVersion(root, cf, L"1.2.3.4"); |
184 EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); | 185 EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); |
185 | 186 |
186 // "install" Chrome Frame with multi-install. | 187 // "install" Chrome Frame with multi-install. |
187 SetUninstallArguments(root, cf, multi_uninstall_cmd); | 188 SetUninstallArguments(root, cf, multi_uninstall_cmd); |
188 EXPECT_EQ(2U, package->GetMultiInstallDependencyCount()); | 189 EXPECT_EQ(2U, package->GetMultiInstallDependencyCount()); |
189 } | 190 } |
OLD | NEW |