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

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

Issue 6126002: Remove base/scoped_handle_win.h stub and fix up all callers to use the new location and namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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/scoped_handle.h"
8 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.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"
11 #include "chrome/installer/util/master_preferences.h" 11 #include "chrome/installer/util/master_preferences.h"
12 #include "chrome/installer/util/package.h" 12 #include "chrome/installer/util/package.h"
13 #include "chrome/installer/util/package_properties.h" 13 #include "chrome/installer/util/package_properties.h"
14 #include "chrome/installer/util/product.h" 14 #include "chrome/installer/util/product.h"
15 #include "chrome/installer/util/product_unittest.h" 15 #include "chrome/installer/util/product_unittest.h"
16 #include "chrome/installer/util/util_constants.h" 16 #include "chrome/installer/util/util_constants.h"
17 17
18 using base::win::RegKey; 18 using base::win::RegKey;
19 using base::win::ScopedHandle;
20 using installer::ChromePackageProperties; 19 using installer::ChromePackageProperties;
21 using installer::ChromiumPackageProperties; 20 using installer::ChromiumPackageProperties;
22 using installer::Package; 21 using installer::Package;
23 using installer::Product; 22 using installer::Product;
24 using installer::MasterPreferences; 23 using installer::MasterPreferences;
25 24
26 class PackageTest : public TestWithTempDirAndDeleteTempOverrideKeys { 25 class PackageTest : public TestWithTempDirAndDeleteTempOverrideKeys {
27 protected: 26 protected:
28 }; 27 };
29 28
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 file_util::CreateDirectory(old_version_dir); 64 file_util::CreateDirectory(old_version_dir);
66 EXPECT_TRUE(file_util::PathExists(old_version_dir)); 65 EXPECT_TRUE(file_util::PathExists(old_version_dir));
67 66
68 // Create a fake chrome.dll key file in the old version directory. This 67 // Create a fake chrome.dll key file in the old version directory. This
69 // should prevent the old version directory from getting deleted. 68 // should prevent the old version directory from getting deleted.
70 FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll)); 69 FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll));
71 EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); 70 EXPECT_FALSE(file_util::PathExists(old_chrome_dll));
72 71
73 // Hold on to the file exclusively to prevent the directory from 72 // Hold on to the file exclusively to prevent the directory from
74 // being deleted. 73 // being deleted.
75 ScopedHandle file(::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, 74 base::win::ScopedHandle file(
76 0, NULL, OPEN_ALWAYS, 0, NULL)); 75 ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ,
76 0, NULL, OPEN_ALWAYS, 0, NULL));
77 EXPECT_TRUE(file.IsValid()); 77 EXPECT_TRUE(file.IsValid());
78 EXPECT_TRUE(file_util::PathExists(old_chrome_dll)); 78 EXPECT_TRUE(file_util::PathExists(old_chrome_dll));
79 79
80 package->RemoveOldVersionDirectories(*new_version.get()); 80 package->RemoveOldVersionDirectories(*new_version.get());
81 // The old directory should still exist. 81 // The old directory should still exist.
82 EXPECT_TRUE(file_util::PathExists(old_version_dir)); 82 EXPECT_TRUE(file_util::PathExists(old_version_dir));
83 EXPECT_TRUE(file_util::PathExists(new_version_dir)); 83 EXPECT_TRUE(file_util::PathExists(new_version_dir));
84 84
85 // Now close the file handle to make it possible to delete our key file. 85 // Now close the file handle to make it possible to delete our key file.
86 file.Close(); 86 file.Close();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 // "install" Chrome Frame without multi-install. 181 // "install" Chrome Frame without multi-install.
182 SetUninstallArguments(root, cf, single_uninstall_cmd); 182 SetUninstallArguments(root, cf, single_uninstall_cmd);
183 SetInstalledVersion(root, cf, L"1.2.3.4"); 183 SetInstalledVersion(root, cf, L"1.2.3.4");
184 EXPECT_EQ(1U, package->GetMultiInstallDependencyCount()); 184 EXPECT_EQ(1U, package->GetMultiInstallDependencyCount());
185 185
186 // "install" Chrome Frame with multi-install. 186 // "install" Chrome Frame with multi-install.
187 SetUninstallArguments(root, cf, multi_uninstall_cmd); 187 SetUninstallArguments(root, cf, multi_uninstall_cmd);
188 EXPECT_EQ(2U, package->GetMultiInstallDependencyCount()); 188 EXPECT_EQ(2U, package->GetMultiInstallDependencyCount());
189 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698