OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/scoped_handle.h" | 6 #include "base/scoped_handle.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/installer/util/browser_distribution.h" | 8 #include "chrome/installer/util/browser_distribution.h" |
9 #include "chrome/installer/util/channel_info.h" | 9 #include "chrome/installer/util/channel_info.h" |
10 #include "chrome/installer/util/google_update_constants.h" | 10 #include "chrome/installer/util/google_update_constants.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // operations are correct | 32 // operations are correct |
33 TEST_F(PackageTest, Basic) { | 33 TEST_F(PackageTest, Basic) { |
34 const bool system_level = true; | 34 const bool system_level = true; |
35 ChromiumPackageProperties properties; | 35 ChromiumPackageProperties properties; |
36 scoped_refptr<Package> package(new Package(system_level, test_dir_.path(), | 36 scoped_refptr<Package> package(new Package(system_level, test_dir_.path(), |
37 &properties)); | 37 &properties)); |
38 EXPECT_EQ(test_dir_.path().value(), package->path().value()); | 38 EXPECT_EQ(test_dir_.path().value(), package->path().value()); |
39 EXPECT_TRUE(package->IsEqual(test_dir_.path())); | 39 EXPECT_TRUE(package->IsEqual(test_dir_.path())); |
40 EXPECT_EQ(0U, package->products().size()); | 40 EXPECT_EQ(0U, package->products().size()); |
41 | 41 |
42 const wchar_t kOldVersion[] = L"1.2.3.4"; | 42 const char kOldVersion[] = "1.2.3.4"; |
43 const wchar_t kNewVersion[] = L"2.3.4.5"; | 43 const char kNewVersion[] = "2.3.4.5"; |
44 | 44 |
45 scoped_ptr<Version> new_version(Version::GetVersionFromString(kNewVersion)); | 45 scoped_ptr<Version> new_version(Version::GetVersionFromString(kNewVersion)); |
46 scoped_ptr<Version> old_version(Version::GetVersionFromString(kOldVersion)); | 46 scoped_ptr<Version> old_version(Version::GetVersionFromString(kOldVersion)); |
47 ASSERT_TRUE(new_version.get() != NULL); | 47 ASSERT_TRUE(new_version.get() != NULL); |
48 ASSERT_TRUE(old_version.get() != NULL); | 48 ASSERT_TRUE(old_version.get() != NULL); |
49 | 49 |
50 FilePath installer_dir(package->GetInstallerDirectory(*new_version.get())); | 50 FilePath installer_dir(package->GetInstallerDirectory(*new_version.get())); |
51 EXPECT_FALSE(installer_dir.empty()); | 51 EXPECT_FALSE(installer_dir.empty()); |
52 | 52 |
53 FilePath new_version_dir(package->path().Append( | 53 FilePath new_version_dir(package->path().Append( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 BrowserDistribution* distribution = | 102 BrowserDistribution* distribution = |
103 BrowserDistribution::GetSpecificDistribution( | 103 BrowserDistribution::GetSpecificDistribution( |
104 BrowserDistribution::CHROME_BROWSER, prefs); | 104 BrowserDistribution::CHROME_BROWSER, prefs); |
105 ChromePackageProperties properties; | 105 ChromePackageProperties properties; |
106 scoped_refptr<Package> package(new Package(system_level, test_dir_.path(), | 106 scoped_refptr<Package> package(new Package(system_level, test_dir_.path(), |
107 &properties)); | 107 &properties)); |
108 scoped_refptr<Product> product(new Product(distribution, package.get())); | 108 scoped_refptr<Product> product(new Product(distribution, package.get())); |
109 EXPECT_EQ(1U, package->products().size()); | 109 EXPECT_EQ(1U, package->products().size()); |
110 EXPECT_EQ(system_level, package->system_level()); | 110 EXPECT_EQ(system_level, package->system_level()); |
111 | 111 |
112 const wchar_t kCurrentVersion[] = L"1.2.3.4"; | 112 const char kCurrentVersion[] = "1.2.3.4"; |
113 scoped_ptr<Version> current_version( | 113 scoped_ptr<Version> current_version( |
114 Version::GetVersionFromString(kCurrentVersion)); | 114 Version::GetVersionFromString(kCurrentVersion)); |
115 | 115 |
116 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 116 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
117 { | 117 { |
118 TempRegKeyOverride override(root, L"root_pit"); | 118 TempRegKeyOverride override(root, L"root_pit"); |
119 RegKey chrome_key(root, distribution->GetVersionKey().c_str(), | 119 RegKey chrome_key(root, distribution->GetVersionKey().c_str(), |
120 KEY_ALL_ACCESS); | 120 KEY_ALL_ACCESS); |
121 EXPECT_TRUE(chrome_key.Valid()); | 121 EXPECT_TRUE(chrome_key.Valid()); |
122 if (chrome_key.Valid()) { | 122 if (chrome_key.Valid()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 RegKey cf_key(root, cf->GetStateKey().c_str(), KEY_ALL_ACCESS); | 164 RegKey cf_key(root, cf->GetStateKey().c_str(), KEY_ALL_ACCESS); |
165 channel.SetMultiInstall(false); | 165 channel.SetMultiInstall(false); |
166 channel.Write(&cf_key); | 166 channel.Write(&cf_key); |
167 EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); | 167 EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); |
168 | 168 |
169 // "install" Chrome Frame with multi-install. | 169 // "install" Chrome Frame with multi-install. |
170 channel.SetMultiInstall(true); | 170 channel.SetMultiInstall(true); |
171 channel.Write(&cf_key); | 171 channel.Write(&cf_key); |
172 EXPECT_EQ(2U, package->GetMultiInstallDependencyCount()); | 172 EXPECT_EQ(2U, package->GetMultiInstallDependencyCount()); |
173 } | 173 } |
OLD | NEW |