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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | chrome/installer/util/logging_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <windows.h> 5 #include <windows.h>
6 6
7 #include <fstream> 7 #include <fstream>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 wchar_t text_content_2[] = L"delete me as well"; 92 wchar_t text_content_2[] = L"delete me as well";
93 93
94 // Delete version directories. Everything lower than the given version 94 // Delete version directories. Everything lower than the given version
95 // should be deleted. 95 // should be deleted.
96 TEST_F(InstallerStateTest, Delete) { 96 TEST_F(InstallerStateTest, Delete) {
97 // TODO(grt): move common stuff into the test fixture. 97 // TODO(grt): move common stuff into the test fixture.
98 // Create a Chrome dir 98 // Create a Chrome dir
99 base::FilePath chrome_dir(test_dir_.path()); 99 base::FilePath chrome_dir(test_dir_.path());
100 chrome_dir = chrome_dir.AppendASCII("chrome"); 100 chrome_dir = chrome_dir.AppendASCII("chrome");
101 file_util::CreateDirectory(chrome_dir); 101 file_util::CreateDirectory(chrome_dir);
102 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 102 ASSERT_TRUE(base::PathExists(chrome_dir));
103 103
104 base::FilePath chrome_dir_1(chrome_dir); 104 base::FilePath chrome_dir_1(chrome_dir);
105 chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0"); 105 chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0");
106 file_util::CreateDirectory(chrome_dir_1); 106 file_util::CreateDirectory(chrome_dir_1);
107 ASSERT_TRUE(file_util::PathExists(chrome_dir_1)); 107 ASSERT_TRUE(base::PathExists(chrome_dir_1));
108 108
109 base::FilePath chrome_dir_2(chrome_dir); 109 base::FilePath chrome_dir_2(chrome_dir);
110 chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0"); 110 chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0");
111 file_util::CreateDirectory(chrome_dir_2); 111 file_util::CreateDirectory(chrome_dir_2);
112 ASSERT_TRUE(file_util::PathExists(chrome_dir_2)); 112 ASSERT_TRUE(base::PathExists(chrome_dir_2));
113 113
114 base::FilePath chrome_dir_3(chrome_dir); 114 base::FilePath chrome_dir_3(chrome_dir);
115 chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0"); 115 chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0");
116 file_util::CreateDirectory(chrome_dir_3); 116 file_util::CreateDirectory(chrome_dir_3);
117 ASSERT_TRUE(file_util::PathExists(chrome_dir_3)); 117 ASSERT_TRUE(base::PathExists(chrome_dir_3));
118 118
119 base::FilePath chrome_dir_4(chrome_dir); 119 base::FilePath chrome_dir_4(chrome_dir);
120 chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0"); 120 chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0");
121 file_util::CreateDirectory(chrome_dir_4); 121 file_util::CreateDirectory(chrome_dir_4);
122 ASSERT_TRUE(file_util::PathExists(chrome_dir_4)); 122 ASSERT_TRUE(base::PathExists(chrome_dir_4));
123 123
124 base::FilePath chrome_dll_1(chrome_dir_1); 124 base::FilePath chrome_dll_1(chrome_dir_1);
125 chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll"); 125 chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll");
126 CreateTextFile(chrome_dll_1.value(), text_content_1); 126 CreateTextFile(chrome_dll_1.value(), text_content_1);
127 ASSERT_TRUE(file_util::PathExists(chrome_dll_1)); 127 ASSERT_TRUE(base::PathExists(chrome_dll_1));
128 128
129 base::FilePath chrome_dll_2(chrome_dir_2); 129 base::FilePath chrome_dll_2(chrome_dir_2);
130 chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll"); 130 chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll");
131 CreateTextFile(chrome_dll_2.value(), text_content_1); 131 CreateTextFile(chrome_dll_2.value(), text_content_1);
132 ASSERT_TRUE(file_util::PathExists(chrome_dll_2)); 132 ASSERT_TRUE(base::PathExists(chrome_dll_2));
133 133
134 base::FilePath chrome_dll_3(chrome_dir_3); 134 base::FilePath chrome_dll_3(chrome_dir_3);
135 chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll"); 135 chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll");
136 CreateTextFile(chrome_dll_3.value(), text_content_1); 136 CreateTextFile(chrome_dll_3.value(), text_content_1);
137 ASSERT_TRUE(file_util::PathExists(chrome_dll_3)); 137 ASSERT_TRUE(base::PathExists(chrome_dll_3));
138 138
139 base::FilePath chrome_dll_4(chrome_dir_4); 139 base::FilePath chrome_dll_4(chrome_dir_4);
140 chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll"); 140 chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll");
141 CreateTextFile(chrome_dll_4.value(), text_content_1); 141 CreateTextFile(chrome_dll_4.value(), text_content_1);
142 ASSERT_TRUE(file_util::PathExists(chrome_dll_4)); 142 ASSERT_TRUE(base::PathExists(chrome_dll_4));
143 143
144 MockInstallerState installer_state; 144 MockInstallerState installer_state;
145 BuildSingleChromeState(chrome_dir, &installer_state); 145 BuildSingleChromeState(chrome_dir, &installer_state);
146 Version latest_version("1.0.4.0"); 146 Version latest_version("1.0.4.0");
147 { 147 {
148 base::ScopedTempDir temp_dir; 148 base::ScopedTempDir temp_dir;
149 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 149 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
150 installer_state.RemoveOldVersionDirectories(latest_version, NULL, 150 installer_state.RemoveOldVersionDirectories(latest_version, NULL,
151 temp_dir.path()); 151 temp_dir.path());
152 } 152 }
153 153
154 // old versions should be gone 154 // old versions should be gone
155 EXPECT_FALSE(file_util::PathExists(chrome_dir_1)); 155 EXPECT_FALSE(base::PathExists(chrome_dir_1));
156 EXPECT_FALSE(file_util::PathExists(chrome_dir_2)); 156 EXPECT_FALSE(base::PathExists(chrome_dir_2));
157 EXPECT_FALSE(file_util::PathExists(chrome_dir_3)); 157 EXPECT_FALSE(base::PathExists(chrome_dir_3));
158 // the latest version should stay 158 // the latest version should stay
159 EXPECT_TRUE(file_util::PathExists(chrome_dll_4)); 159 EXPECT_TRUE(base::PathExists(chrome_dll_4));
160 } 160 }
161 161
162 // Delete older version directories, keeping the one in used intact. 162 // Delete older version directories, keeping the one in used intact.
163 TEST_F(InstallerStateTest, DeleteInUsed) { 163 TEST_F(InstallerStateTest, DeleteInUsed) {
164 // Create a Chrome dir 164 // Create a Chrome dir
165 base::FilePath chrome_dir(test_dir_.path()); 165 base::FilePath chrome_dir(test_dir_.path());
166 chrome_dir = chrome_dir.AppendASCII("chrome"); 166 chrome_dir = chrome_dir.AppendASCII("chrome");
167 file_util::CreateDirectory(chrome_dir); 167 file_util::CreateDirectory(chrome_dir);
168 ASSERT_TRUE(file_util::PathExists(chrome_dir)); 168 ASSERT_TRUE(base::PathExists(chrome_dir));
169 169
170 base::FilePath chrome_dir_1(chrome_dir); 170 base::FilePath chrome_dir_1(chrome_dir);
171 chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0"); 171 chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0");
172 file_util::CreateDirectory(chrome_dir_1); 172 file_util::CreateDirectory(chrome_dir_1);
173 ASSERT_TRUE(file_util::PathExists(chrome_dir_1)); 173 ASSERT_TRUE(base::PathExists(chrome_dir_1));
174 174
175 base::FilePath chrome_dir_2(chrome_dir); 175 base::FilePath chrome_dir_2(chrome_dir);
176 chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0"); 176 chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0");
177 file_util::CreateDirectory(chrome_dir_2); 177 file_util::CreateDirectory(chrome_dir_2);
178 ASSERT_TRUE(file_util::PathExists(chrome_dir_2)); 178 ASSERT_TRUE(base::PathExists(chrome_dir_2));
179 179
180 base::FilePath chrome_dir_3(chrome_dir); 180 base::FilePath chrome_dir_3(chrome_dir);
181 chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0"); 181 chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0");
182 file_util::CreateDirectory(chrome_dir_3); 182 file_util::CreateDirectory(chrome_dir_3);
183 ASSERT_TRUE(file_util::PathExists(chrome_dir_3)); 183 ASSERT_TRUE(base::PathExists(chrome_dir_3));
184 184
185 base::FilePath chrome_dir_4(chrome_dir); 185 base::FilePath chrome_dir_4(chrome_dir);
186 chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0"); 186 chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0");
187 file_util::CreateDirectory(chrome_dir_4); 187 file_util::CreateDirectory(chrome_dir_4);
188 ASSERT_TRUE(file_util::PathExists(chrome_dir_4)); 188 ASSERT_TRUE(base::PathExists(chrome_dir_4));
189 189
190 base::FilePath chrome_dll_1(chrome_dir_1); 190 base::FilePath chrome_dll_1(chrome_dir_1);
191 chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll"); 191 chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll");
192 CreateTextFile(chrome_dll_1.value(), text_content_1); 192 CreateTextFile(chrome_dll_1.value(), text_content_1);
193 ASSERT_TRUE(file_util::PathExists(chrome_dll_1)); 193 ASSERT_TRUE(base::PathExists(chrome_dll_1));
194 194
195 base::FilePath chrome_dll_2(chrome_dir_2); 195 base::FilePath chrome_dll_2(chrome_dir_2);
196 chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll"); 196 chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll");
197 CreateTextFile(chrome_dll_2.value(), text_content_1); 197 CreateTextFile(chrome_dll_2.value(), text_content_1);
198 ASSERT_TRUE(file_util::PathExists(chrome_dll_2)); 198 ASSERT_TRUE(base::PathExists(chrome_dll_2));
199 199
200 // Open the file to make it in use. 200 // Open the file to make it in use.
201 std::ofstream file; 201 std::ofstream file;
202 file.open(chrome_dll_2.value().c_str()); 202 file.open(chrome_dll_2.value().c_str());
203 203
204 base::FilePath chrome_othera_2(chrome_dir_2); 204 base::FilePath chrome_othera_2(chrome_dir_2);
205 chrome_othera_2 = chrome_othera_2.AppendASCII("othera.dll"); 205 chrome_othera_2 = chrome_othera_2.AppendASCII("othera.dll");
206 CreateTextFile(chrome_othera_2.value(), text_content_2); 206 CreateTextFile(chrome_othera_2.value(), text_content_2);
207 ASSERT_TRUE(file_util::PathExists(chrome_othera_2)); 207 ASSERT_TRUE(base::PathExists(chrome_othera_2));
208 208
209 base::FilePath chrome_otherb_2(chrome_dir_2); 209 base::FilePath chrome_otherb_2(chrome_dir_2);
210 chrome_otherb_2 = chrome_otherb_2.AppendASCII("otherb.dll"); 210 chrome_otherb_2 = chrome_otherb_2.AppendASCII("otherb.dll");
211 CreateTextFile(chrome_otherb_2.value(), text_content_2); 211 CreateTextFile(chrome_otherb_2.value(), text_content_2);
212 ASSERT_TRUE(file_util::PathExists(chrome_otherb_2)); 212 ASSERT_TRUE(base::PathExists(chrome_otherb_2));
213 213
214 base::FilePath chrome_dll_3(chrome_dir_3); 214 base::FilePath chrome_dll_3(chrome_dir_3);
215 chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll"); 215 chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll");
216 CreateTextFile(chrome_dll_3.value(), text_content_1); 216 CreateTextFile(chrome_dll_3.value(), text_content_1);
217 ASSERT_TRUE(file_util::PathExists(chrome_dll_3)); 217 ASSERT_TRUE(base::PathExists(chrome_dll_3));
218 218
219 base::FilePath chrome_dll_4(chrome_dir_4); 219 base::FilePath chrome_dll_4(chrome_dir_4);
220 chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll"); 220 chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll");
221 CreateTextFile(chrome_dll_4.value(), text_content_1); 221 CreateTextFile(chrome_dll_4.value(), text_content_1);
222 ASSERT_TRUE(file_util::PathExists(chrome_dll_4)); 222 ASSERT_TRUE(base::PathExists(chrome_dll_4));
223 223
224 MockInstallerState installer_state; 224 MockInstallerState installer_state;
225 BuildSingleChromeState(chrome_dir, &installer_state); 225 BuildSingleChromeState(chrome_dir, &installer_state);
226 Version latest_version("1.0.4.0"); 226 Version latest_version("1.0.4.0");
227 Version existing_version("1.0.1.0"); 227 Version existing_version("1.0.1.0");
228 { 228 {
229 base::ScopedTempDir temp_dir; 229 base::ScopedTempDir temp_dir;
230 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 230 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
231 installer_state.RemoveOldVersionDirectories(latest_version, 231 installer_state.RemoveOldVersionDirectories(latest_version,
232 &existing_version, 232 &existing_version,
233 temp_dir.path()); 233 temp_dir.path());
234 } 234 }
235 235
236 // the version defined as the existing version should stay 236 // the version defined as the existing version should stay
237 EXPECT_TRUE(file_util::PathExists(chrome_dir_1)); 237 EXPECT_TRUE(base::PathExists(chrome_dir_1));
238 // old versions not in used should be gone 238 // old versions not in used should be gone
239 EXPECT_FALSE(file_util::PathExists(chrome_dir_3)); 239 EXPECT_FALSE(base::PathExists(chrome_dir_3));
240 // every thing under in used version should stay 240 // every thing under in used version should stay
241 EXPECT_TRUE(file_util::PathExists(chrome_dir_2)); 241 EXPECT_TRUE(base::PathExists(chrome_dir_2));
242 EXPECT_TRUE(file_util::PathExists(chrome_dll_2)); 242 EXPECT_TRUE(base::PathExists(chrome_dll_2));
243 EXPECT_TRUE(file_util::PathExists(chrome_othera_2)); 243 EXPECT_TRUE(base::PathExists(chrome_othera_2));
244 EXPECT_TRUE(file_util::PathExists(chrome_otherb_2)); 244 EXPECT_TRUE(base::PathExists(chrome_otherb_2));
245 // the latest version should stay 245 // the latest version should stay
246 EXPECT_TRUE(file_util::PathExists(chrome_dll_4)); 246 EXPECT_TRUE(base::PathExists(chrome_dll_4));
247 } 247 }
248 248
249 // Tests a few basic things of the Package class. Makes sure that the path 249 // Tests a few basic things of the Package class. Makes sure that the path
250 // operations are correct 250 // operations are correct
251 TEST_F(InstallerStateTest, Basic) { 251 TEST_F(InstallerStateTest, Basic) {
252 const bool multi_install = false; 252 const bool multi_install = false;
253 const bool system_level = true; 253 const bool system_level = true;
254 CommandLine cmd_line = CommandLine::FromString( 254 CommandLine cmd_line = CommandLine::FromString(
255 std::wstring(L"setup.exe") + 255 std::wstring(L"setup.exe") +
256 (multi_install ? L" --multi-install --chrome" : L"") + 256 (multi_install ? L" --multi-install --chrome" : L"") +
(...skipping 17 matching lines...) Expand all
274 274
275 base::FilePath installer_dir( 275 base::FilePath installer_dir(
276 installer_state.GetInstallerDirectory(new_version)); 276 installer_state.GetInstallerDirectory(new_version));
277 EXPECT_FALSE(installer_dir.empty()); 277 EXPECT_FALSE(installer_dir.empty());
278 278
279 base::FilePath new_version_dir(installer_state.target_path().Append( 279 base::FilePath new_version_dir(installer_state.target_path().Append(
280 UTF8ToWide(new_version.GetString()))); 280 UTF8ToWide(new_version.GetString())));
281 base::FilePath old_version_dir(installer_state.target_path().Append( 281 base::FilePath old_version_dir(installer_state.target_path().Append(
282 UTF8ToWide(old_version.GetString()))); 282 UTF8ToWide(old_version.GetString())));
283 283
284 EXPECT_FALSE(file_util::PathExists(new_version_dir)); 284 EXPECT_FALSE(base::PathExists(new_version_dir));
285 EXPECT_FALSE(file_util::PathExists(old_version_dir)); 285 EXPECT_FALSE(base::PathExists(old_version_dir));
286 286
287 EXPECT_FALSE(file_util::PathExists(installer_dir)); 287 EXPECT_FALSE(base::PathExists(installer_dir));
288 file_util::CreateDirectory(installer_dir); 288 file_util::CreateDirectory(installer_dir);
289 EXPECT_TRUE(file_util::PathExists(new_version_dir)); 289 EXPECT_TRUE(base::PathExists(new_version_dir));
290 290
291 file_util::CreateDirectory(old_version_dir); 291 file_util::CreateDirectory(old_version_dir);
292 EXPECT_TRUE(file_util::PathExists(old_version_dir)); 292 EXPECT_TRUE(base::PathExists(old_version_dir));
293 293
294 // Create a fake chrome.dll key file in the old version directory. This 294 // Create a fake chrome.dll key file in the old version directory. This
295 // should prevent the old version directory from getting deleted. 295 // should prevent the old version directory from getting deleted.
296 base::FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll)); 296 base::FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll));
297 EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); 297 EXPECT_FALSE(base::PathExists(old_chrome_dll));
298 298
299 // Hold on to the file exclusively to prevent the directory from 299 // Hold on to the file exclusively to prevent the directory from
300 // being deleted. 300 // being deleted.
301 base::win::ScopedHandle file( 301 base::win::ScopedHandle file(
302 ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, 302 ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ,
303 0, NULL, OPEN_ALWAYS, 0, NULL)); 303 0, NULL, OPEN_ALWAYS, 0, NULL));
304 EXPECT_TRUE(file.IsValid()); 304 EXPECT_TRUE(file.IsValid());
305 EXPECT_TRUE(file_util::PathExists(old_chrome_dll)); 305 EXPECT_TRUE(base::PathExists(old_chrome_dll));
306 306
307 base::ScopedTempDir temp_dir; 307 base::ScopedTempDir temp_dir;
308 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 308 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
309 309
310 // Don't explicitly tell the directory cleanup logic not to delete the 310 // Don't explicitly tell the directory cleanup logic not to delete the
311 // old version, rely on the key files to keep it around. 311 // old version, rely on the key files to keep it around.
312 installer_state.RemoveOldVersionDirectories(new_version, 312 installer_state.RemoveOldVersionDirectories(new_version,
313 NULL, 313 NULL,
314 temp_dir.path()); 314 temp_dir.path());
315 315
316 // The old directory should still exist. 316 // The old directory should still exist.
317 EXPECT_TRUE(file_util::PathExists(old_version_dir)); 317 EXPECT_TRUE(base::PathExists(old_version_dir));
318 EXPECT_TRUE(file_util::PathExists(new_version_dir)); 318 EXPECT_TRUE(base::PathExists(new_version_dir));
319 319
320 // Now close the file handle to make it possible to delete our key file. 320 // Now close the file handle to make it possible to delete our key file.
321 file.Close(); 321 file.Close();
322 322
323 installer_state.RemoveOldVersionDirectories(new_version, 323 installer_state.RemoveOldVersionDirectories(new_version,
324 NULL, 324 NULL,
325 temp_dir.path()); 325 temp_dir.path());
326 // The new directory should still exist. 326 // The new directory should still exist.
327 EXPECT_TRUE(file_util::PathExists(new_version_dir)); 327 EXPECT_TRUE(base::PathExists(new_version_dir));
328 328
329 // Now, the old directory and key file should be gone. 329 // Now, the old directory and key file should be gone.
330 EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); 330 EXPECT_FALSE(base::PathExists(old_chrome_dll));
331 EXPECT_FALSE(file_util::PathExists(old_version_dir)); 331 EXPECT_FALSE(base::PathExists(old_version_dir));
332 } 332 }
333 333
334 TEST_F(InstallerStateTest, WithProduct) { 334 TEST_F(InstallerStateTest, WithProduct) {
335 const bool multi_install = false; 335 const bool multi_install = false;
336 const bool system_level = true; 336 const bool system_level = true;
337 CommandLine cmd_line = CommandLine::FromString( 337 CommandLine cmd_line = CommandLine::FromString(
338 std::wstring(L"setup.exe") + 338 std::wstring(L"setup.exe") +
339 (multi_install ? L" --multi-install --chrome" : L"") + 339 (multi_install ? L" --multi-install --chrome" : L"") +
340 (system_level ? L" --system-level" : L"")); 340 (system_level ? L" --system-level" : L""));
341 MasterPreferences prefs(cmd_line); 341 MasterPreferences prefs(cmd_line);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 installer_state.target_path().Append(ASCIIToWide(kOldChromeExeVersion)), 529 installer_state.target_path().Append(ASCIIToWide(kOldChromeExeVersion)),
530 installer_state.target_path().Append(L"2.1.1.0"), 530 installer_state.target_path().Append(L"2.1.1.0"),
531 installer_state.target_path().Append(ASCIIToWide(kChromeExeVersion)), 531 installer_state.target_path().Append(ASCIIToWide(kChromeExeVersion)),
532 installer_state.target_path().Append(ASCIIToWide(kNewVersion)), 532 installer_state.target_path().Append(ASCIIToWide(kNewVersion)),
533 installer_state.target_path().Append(L"3.9.1.1"), 533 installer_state.target_path().Append(L"3.9.1.1"),
534 }; 534 };
535 535
536 // Create the version directories. 536 // Create the version directories.
537 for (int i = 0; i < arraysize(version_dirs); i++) { 537 for (int i = 0; i < arraysize(version_dirs); i++) {
538 file_util::CreateDirectory(version_dirs[i]); 538 file_util::CreateDirectory(version_dirs[i]);
539 EXPECT_TRUE(file_util::PathExists(version_dirs[i])); 539 EXPECT_TRUE(base::PathExists(version_dirs[i]));
540 } 540 }
541 541
542 // Create exes with the appropriate version resource. 542 // Create exes with the appropriate version resource.
543 // Use the current test exe as a baseline. 543 // Use the current test exe as a baseline.
544 base::FilePath exe_path; 544 base::FilePath exe_path;
545 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &exe_path)); 545 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &exe_path));
546 546
547 struct target_info { 547 struct target_info {
548 base::FilePath target_file; 548 base::FilePath target_file;
549 const Version& target_version; 549 const Version& target_version;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // Critical update newer than the new version. 749 // Critical update newer than the new version.
750 EXPECT_FALSE( 750 EXPECT_FALSE(
751 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); 751 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid());
752 EXPECT_FALSE( 752 EXPECT_FALSE(
753 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) 753 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_)
754 .IsValid()); 754 .IsValid());
755 EXPECT_FALSE( 755 EXPECT_FALSE(
756 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) 756 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_)
757 .IsValid()); 757 .IsValid());
758 } 758 }
OLDNEW
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | chrome/installer/util/logging_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698