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

Side by Side Diff: chrome/installer/test/alternate_version_generator.cc

Issue 5236002: Add infrastructure enabling tests of installer upgrade scenarios.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // The file contains the implementation of the mini_installer re-versioner.
6 // The main function (GenerateNextVersion) does the following in a temp dir:
7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from
8 // mini_installer.exe.
9 // - Inspects setup.exe to determine the current version.
10 // - Runs through all .dll and .exe files:
11 // - Replacing all occurrences of the Unicode version string in the files'
12 // resources with the updated string.
13 // - For all resources in which the string substitution is made, the binary
14 // form of the version is also replaced.
15 // - Re-packs setup.exe and Chrome-bin.
16 // - Inserts them into the target mini_installer.exe.
17
18 #include "chrome/installer/test/alternate_version_generator.h"
19
20 #include <windows.h>
21
22 #include <algorithm>
23 #include <sstream>
24 #include <limits>
25 #include <utility>
26 #include <vector>
27
28 #include "base/basictypes.h"
29 #include "base/file_path.h"
30 #include "base/file_util.h"
31 #include "base/logging.h"
32 #include "base/platform_file.h"
33 #include "base/win/pe_image.h"
34 #include "base/win/scoped_handle.h"
35 #include "chrome/installer/test/pe_image_resources.h"
36 #include "chrome/installer/test/resource_loader.h"
37 #include "chrome/installer/test/resource_updater.h"
38 #include "chrome/installer/util/lzma_util.h"
39 #include "testing/gtest/include/gtest/gtest.h"
40
41 // Notes:
robertshield 2010/11/19 20:56:42 Could we move this Notes section up to the comment
grt (UTC plus 2) 2010/11/22 17:53:29 I've deleted the notes since they are no longer re
42 // Modifying a resource may mean moving around the contents of the .rsrc
43 // section, which would mean adjusting all resources that follow as well as
44 // potentially all sections that follow.
45
46 namespace {
47
48 const wchar_t k7zaPath[] =
49 L"..\\..\\third_party\\lzma_sdk\\Executable\\7za.exe";
robertshield 2010/11/19 20:56:42 I'm uneasy about the "..\\"s, I'd prefer if the st
grt (UTC plus 2) 2010/11/22 17:53:29 I've changed these a bit. See my response to your
50 const wchar_t kB7[] = L"B7";
51 const wchar_t kBl[] = L"BL";
52 const wchar_t kChrome7z[] = L"chrome.7z";
53 const wchar_t kChromeBin[] = L"Chrome-bin";
54 const wchar_t kChromePacked7z[] = L"chrome.packed.7z";
55 const wchar_t kExe[] = L"exe";
56 const wchar_t kExpandExe[] = L"expand.exe";
57 const wchar_t kExtDll[] = L".dll";
58 const wchar_t kExtExe[] = L".exe";
59 const wchar_t kMakeCab[] = L"makecab.exe";
60 const wchar_t kSetupEx_[] = L"setup.ex_";
61 const wchar_t kSetupExe[] = L"setup.exe";
62 const wchar_t kTempDirPrefix[] = L"mini_installer_test_temp";
63
64 // A helper class for creating and cleaning a temporary directory. A temporary
65 // directory is created in Initialize and destroyed (along with all of its
66 // contents) when the guard instance is destroyed.
67 class ScopedTempDirectory {
68 public:
69 ScopedTempDirectory() { }
70 ~ScopedTempDirectory() {
71 if (!directory_.empty() && !file_util::Delete(directory_, true)) {
72 LOG(DFATAL) << "Failed deleting temporary directory \""
73 << directory_.value() << "\"";
74 }
75 }
76 // Creates a temporary directory.
77 bool Initialize() {
78 DCHECK(directory_.empty());
79 if (!file_util::CreateNewTempDirectory(&kTempDirPrefix[0], &directory_)) {
80 LOG(DFATAL) << "Failed creating temporary directory.";
81 return false;
82 }
83 return true;
84 }
85 const FilePath& directory() const {
86 DCHECK(!directory_.empty());
87 return directory_;
88 }
89 private:
90 FilePath directory_;
91 DISALLOW_COPY_AND_ASSIGN(ScopedTempDirectory);
92 }; // class ScopedTempDirectory
93
94 // A helper class for manipulating a Chrome product version.
95 class ChromeVersion {
96 public:
97 static ChromeVersion FromHighLow(DWORD high, DWORD low) {
98 return ChromeVersion(static_cast<ULONGLONG>(high) << 32 |
99 static_cast<ULONGLONG>(low));
100 }
101 ChromeVersion() { }
102 explicit ChromeVersion(ULONGLONG value) : version_(value) { }
103 WORD major() const { return static_cast<WORD>(version_ >> 48); }
104 WORD minor() const { return static_cast<WORD>(version_ >> 32); }
105 WORD build() const { return static_cast<WORD>(version_ >> 16); }
106 WORD patch() const { return static_cast<WORD>(version_); }
107 DWORD high() const { return static_cast<DWORD>(version_ >> 32); }
108 DWORD low() const { return static_cast<DWORD>(version_); }
109 ULONGLONG value() const { return version_; }
110 void set_value(ULONGLONG value) { version_ = value; }
111 std::wstring ToString() const;
112 private:
113 ULONGLONG version_;
114 }; // class ChromeVersion
115
116 std::wstring ChromeVersion::ToString() const {
117 wchar_t buffer[24];
118 int string_len =
119 swprintf_s(&buffer[0], arraysize(buffer), L"%hu.%hu.%hu.%hu",
120 major(), minor(), build(), patch());
121 DCHECK_NE(-1, string_len);
122 DCHECK_GT(static_cast<int>(arraysize(buffer)), string_len);
123 return std::wstring(&buffer[0], string_len);
124 }
125
126 // A read/write mapping of a file.
127 // Note: base::MemoryMappedFile is not used because it doesn't support
128 // read/write mappings. Adding such support across all platforms for this
129 // Windows-only test code seems like overkill.
130 class MappedFile {
131 public:
132 MappedFile() : size_(), mapping_(), view_() { }
133 ~MappedFile();
134 bool Initialize(base::PlatformFile file);
135 LPVOID data() const { return view_; }
tommi (sloooow) - chröme 2010/11/19 20:14:38 I think we prefer void* to LPVOID like defs (excep
grt (UTC plus 2) 2010/11/22 17:53:29 Done.
136 size_t size() const { return size_; }
137 private:
138 size_t size_;
139 HANDLE mapping_;
140 LPVOID view_;
141 DISALLOW_COPY_AND_ASSIGN(MappedFile);
142 }; // class MappedFile
143
144 MappedFile::~MappedFile() {
145 if (view_ != NULL) {
146 EXPECT_NE(0, UnmapViewOfFile(view_));
147 }
148 if (mapping_ != NULL) {
149 EXPECT_NE(0, CloseHandle(mapping_));
150 }
151 }
152
153 bool MappedFile::Initialize(base::PlatformFile file) {
154 DCHECK(mapping_ == NULL);
155 bool result = false;
156 base::PlatformFileInfo file_info;
157
158 if (base::GetPlatformFileInfo(file, &file_info)) {
159 if (file_info.size <=
160 static_cast<int64>(std::numeric_limits<size_t>::max())) {
161 mapping_ = CreateFileMapping(file, NULL, PAGE_READWRITE, 0,
162 static_cast<DWORD>(file_info.size), NULL);
163 if (mapping_ != NULL) {
164 view_ = MapViewOfFile(mapping_, FILE_MAP_WRITE, 0, 0,
165 static_cast<size_t>(file_info.size));
166 if (view_ != NULL) {
167 result = true;
168 } else {
169 PLOG(DFATAL) << "MapViewOfFile failed";
170 }
171 } else {
172 PLOG(DFATAL) << "CreateFileMapping failed";
173 }
174 } else {
175 LOG(DFATAL) << "Files larger than " << std::numeric_limits<size_t>::max()
176 << " are not supported.";
177 }
178 } else {
179 PLOG(DFATAL) << "GetPlatformFileInfo failed";
180 }
181 return result;
182 }
183
184 // Calls CreateProcess with good default parameters and waits for the process
185 // to terminate returning the process exit code.
186 bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline,
tommi (sloooow) - chröme 2010/11/19 20:14:38 Would it make sense to use the CommandLine class h
grt (UTC plus 2) 2010/11/22 17:53:29 I'm not sure. It looks to me like CommandLine::Ap
tommi (sloooow) - chröme 2010/11/22 19:43:42 agreed. keep as is.
187 int* exit_code) {
robertshield 2010/11/19 20:56:42 can't you use base::LaunchApp() in process_utils.h
grt (UTC plus 2) 2010/11/22 17:53:29 I thought it would be nice to use CREATE_NO_WINDOW
robertshield 2010/11/22 19:59:08 Ideally there would be a --silent argument that co
grt (UTC plus 2) 2010/11/22 20:49:23 Done (although no such luck finding flags for the
188 std::vector<wchar_t> cmd_line(cmdline.c_str(),
189 cmdline.c_str() + cmdline.size() + 1);
190 STARTUPINFOW si = {sizeof(si)};
191 PROCESS_INFORMATION pi = {0};
192 if (!CreateProcess(exe_path, &cmd_line[0], NULL, NULL, FALSE,
193 CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) {
194 PLOG(DFATAL) << "CreateProcess failed with command line: \"" << cmdline
195 << "\"";
196 return false;
197 }
198
199 CloseHandle(pi.hThread);
200 bool result = true;
201 DWORD wr = WaitForSingleObject(pi.hProcess, INFINITE);
202 if (wr == WAIT_OBJECT_0) {
203 if (exit_code) {
204 if (!GetExitCodeProcess(pi.hProcess,
205 reinterpret_cast<DWORD*>(exit_code))) {
206 PLOG(DFATAL) << "Failed getting the exit code for \""
207 << &cmd_line[0] << "\".";
208 result = false;
209 }
210 }
tommi (sloooow) - chröme 2010/11/19 20:14:38 maybe add a DCHECK(exit_code != STILL_RUNNING) if
grt (UTC plus 2) 2010/11/22 17:53:29 Done.
211 } else {
212 if (wr == WAIT_FAILED) {
213 PLOG(DFATAL) << "Failed while waiting for \"" << &cmd_line[0]
214 << "\" to exit.";
215 } else {
216 LOG(DFATAL) << "Received result " << wr << " while waiting for \""
217 << &cmd_line[0] << "\" to exit.";
218 }
219 result = false;
220 }
221
222 CloseHandle(pi.hProcess);
223 return result;
224 }
225
226 // Retrieves the version number of setup.exe in |work_dir| from its version
227 // resource, placing the value in |version|. Returns true on success.
228 bool GetSetupExeVersion(const FilePath& work_dir, ChromeVersion* version) {
229 DCHECK(version);
230 bool result = false;
231 upgrade_test::ResourceLoader setup;
232 std::pair<const uint8*, DWORD> version_info_data;
233
234 if (setup.Initialize(work_dir.Append(&kSetupExe[0])) &&
235 setup.Load(VS_VERSION_INFO, reinterpret_cast<WORD>(RT_VERSION),
236 &version_info_data)) {
237 const VS_FIXEDFILEINFO* fixed_file_info;
238 UINT ver_info_len;
239 if (VerQueryValue(version_info_data.first, L"\\",
240 reinterpret_cast<void**>(
241 const_cast<VS_FIXEDFILEINFO**>(&fixed_file_info)),
242 &ver_info_len) != 0) {
243 DCHECK_EQ(sizeof(VS_FIXEDFILEINFO), static_cast<size_t>(ver_info_len));
244 *version = ChromeVersion::FromHighLow(fixed_file_info->dwFileVersionMS,
245 fixed_file_info->dwFileVersionLS);
246 result = true;
247 } else {
248 LOG(DFATAL) << "VerQueryValue failed to retrieve VS_FIXEDFILEINFO";
249 }
250 }
251
252 return result;
253 }
254
255 // Replace all occurrences in the sequence [|dest_first|, |dest_last) that
256 // equals [|src_first|, |src_last) with the sequence at |replacement_first| of
257 // the same length. Returns true on success. If non-NULL, |replacements_made|
258 // is set to true/false accordingly.
259 bool ReplaceAll(uint8* dest_first, uint8* dest_last,
260 const uint8* src_first, const uint8* src_last,
261 const uint8* replacement_first, bool* replacements_made) {
262 bool result = true;
263 bool changed = false;
264 do {
265 dest_first = std::search(dest_first, dest_last, src_first, src_last);
266 if (dest_first == dest_last) {
267 break;
268 }
269 changed = true;
270 if (memcpy_s(dest_first, dest_last - dest_first,
271 replacement_first, src_last - src_first) != 0) {
272 result = false;
273 break;
274 }
275 dest_first += (src_last - src_first);
276 } while (true);
277
278 if (replacements_made != NULL) {
279 *replacements_made = changed;
280 }
281
282 return result;
283 }
284
285 // A context structure in support of our EnumResource_Fn function.
286 struct VisitResourceContext {
287 ChromeVersion current_version;
288 std::wstring current_version_str;
289 ChromeVersion new_version;
290 std::wstring new_version_str;
291 }; // struct VisitResourceContext
292
293 // Replaces the old version with the new in a resource. A first pass is made to
294 // replace the string form (e.g., "9.0.584.0"). If any replacements are made, a
295 // second pass is made to replace the binary form (e.g., 0x0000024800000009).
296 void VisitResource(const upgrade_test::EntryPath& path,
297 uint8* data, DWORD size, DWORD code_page,
298 uintptr_t context) {
299 VisitResourceContext& ctx = *reinterpret_cast<VisitResourceContext*>(context);
300
301 // Replace all occurrences of current_version_str with new_version_str
302 bool changing_version = false;
303 if (ReplaceAll(
304 data, data + size,
robertshield 2010/11/19 20:56:42 for readability, these two arguments should be on
grt (UTC plus 2) 2010/11/22 17:53:29 Done.
305 reinterpret_cast<const uint8*>(ctx.current_version_str.c_str()),
306 reinterpret_cast<const uint8*>(ctx.current_version_str.c_str() +
307 ctx.current_version_str.size() + 1),
308 reinterpret_cast<const uint8*>(ctx.new_version_str.c_str()),
309 &changing_version) &&
310 changing_version) {
311 // Replace all occurrences of current_version with new_version
312 struct VersionPair {
313 DWORD high;
314 DWORD low;
315 };
316 VersionPair cur_ver = {
317 ctx.current_version.high(), ctx.current_version.low()
318 };
319 VersionPair new_ver = {
320 ctx.new_version.high(), ctx.new_version.low()
321 };
322 ReplaceAll(data, data + size, reinterpret_cast<const uint8*>(&cur_ver),
323 reinterpret_cast<const uint8*>(&cur_ver) + sizeof(cur_ver),
324 reinterpret_cast<const uint8*>(&new_ver), NULL);
325 }
326 }
327
328 // Updates the version strings and numbers in all of |image_file|'s resources.
329 bool UpdateVersionIfMatch(const FilePath& image_file,
330 VisitResourceContext* context) {
331 bool result = false;
332 base::win::ScopedHandle image_handle(base::CreatePlatformFile(
333 image_file,
334 (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ |
335 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_READ |
336 base::PLATFORM_FILE_EXCLUSIVE_WRITE), NULL, NULL));
337 if (image_handle.Get() != INVALID_HANDLE_VALUE) {
338 MappedFile image_mapping;
339 if (image_mapping.Initialize(image_handle)) {
340 base::win::PEImageAsData image(
341 reinterpret_cast<HMODULE>(image_mapping.data()));
342 // PEImage class does not support other-architecture images.
343 if (image.GetNTHeaders()->OptionalHeader.Magic ==
344 IMAGE_NT_OPTIONAL_HDR_MAGIC) {
345 result = upgrade_test::EnumResources(
346 image, &VisitResource, reinterpret_cast<uintptr_t>(context));
347 } else {
348 result = true;
349 }
350 }
351 } else {
352 PLOG(DFATAL) << "Failed to open \"" << image_file.value() << "\"";
353 }
354 return result;
355 }
356
357 // Bumps the version of all .exe and .dll files in |work_dir|.
robertshield 2010/11/19 20:56:42 update comment to reference version bumping on the
grt (UTC plus 2) 2010/11/22 17:53:29 Done.
358 bool ApplyNextVersion(const FilePath& work_dir) {
359 VisitResourceContext ctx;
360 if (!GetSetupExeVersion(work_dir, &ctx.current_version)) {
361 return false;
362 }
363 ctx.current_version_str = ctx.current_version.ToString();
364
365 // Figure out a future version with the same string length as this one by
366 // incrementing each component.
367 ULONGLONG incrementer = 1;
368
369 do {
370 if (incrementer == 0) {
371 LOG(DFATAL) << "Improbable version composed of only 9s and/or USHRT_MAX";
372 return false;
373 }
374 ctx.new_version.set_value(ctx.current_version.value() + incrementer);
375 ctx.new_version_str = ctx.new_version.ToString();
376 incrementer <<= 16;
377 } while (ctx.new_version_str.size() != ctx.current_version_str.size());
378
379 // Modify all .dll and .exe files with the current version.
380 bool doing_great = true;
tommi (sloooow) - chröme 2010/11/19 20:14:38 /like
grt (UTC plus 2) 2010/11/22 17:53:29 Done. :-)
381 file_util::FileEnumerator all_files(work_dir, true,
382 file_util::FileEnumerator::FILES);
383 do {
384 FilePath file = all_files.Next();
385 if (file.empty()) {
386 break;
387 }
388 std::wstring extension = file.Extension();
389 if (extension == &kExtExe[0] || extension == &kExtDll[0]) {
390 doing_great = UpdateVersionIfMatch(file, &ctx);
391 }
392 } while (doing_great);
393
394 // Change the versioned directory.
395 FilePath chrome_bin = work_dir.Append(&kChromeBin[0]);
396 doing_great = file_util::Move(chrome_bin.Append(ctx.current_version_str),
397 chrome_bin.Append(ctx.new_version_str));
398
399 return doing_great;
400 }
401
402 bool CreateArchive(const FilePath& output_file, const FilePath& input_path,
403 int compression_level) {
404 DCHECK(compression_level == 0 ||
405 compression_level >= 1 && compression_level <= 9 &&
406 (compression_level & 0x01) != 0);
407
408 std::wstring command_line(1, L'"');
409 command_line
robertshield 2010/11/19 20:56:42 since this is a relative path, this code assumes i
grt (UTC plus 2) 2010/11/22 17:53:29 I've done three things: 1) Documented. 2) Made the
410 .append(&k7zaPath[0])
411 .append(L"\" a -t7z \"")
412 .append(output_file.value())
413 .append(L"\" \"")
414 .append(input_path.value())
415 .append(L"\" -mx")
416 .append(1, L'0' + compression_level);
417 int exit_code;
418 if (!RunProcessAndWait(NULL, command_line, &exit_code))
419 return false;
420 if (exit_code != 0) {
421 LOG(DFATAL) << &k7zaPath[0] << " exited with code " << exit_code
422 << " while creating " << output_file.value();
423 return false;
424 }
425 return true;
426 }
427
428 } // namespace
429
430 namespace upgrade_test {
431
432 bool GenerateNextVersion(const FilePath& original_installer_path,
433 const FilePath& target_path) {
434 // Create a temporary directory in which we'll do our work.
435 ScopedTempDirectory work_dir;
436 if (!work_dir.Initialize())
437 return false;
438
439 // Copy the original mini_installer.
440 FilePath mini_installer =
441 work_dir.directory().Append(original_installer_path.BaseName());
tommi (sloooow) - chröme 2010/11/19 20:14:38 indent
grt (UTC plus 2) 2010/11/22 17:53:29 Done.
442 if (!file_util::CopyFile(original_installer_path, mini_installer)) {
443 LOG(DFATAL) << "Failed copying \"" << original_installer_path.value()
444 << "\" to \"" << mini_installer.value() << "\"";
445 return false;
446 }
447
448 FilePath setup_ex_ = work_dir.directory().Append(&kSetupEx_[0]);
449 FilePath chrome_packed_7z = work_dir.directory().Append(&kChromePacked7z[0]);
450 // Load the original file and extract setup.ex_ and chrome.packed.7z
451 {
452 ResourceLoader resource_loader;
453 std::pair<const uint8*, DWORD> resource_data;
454
455 if (!resource_loader.Initialize(mini_installer))
456 return false;
457
458 // Write out setup.ex_
459 if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data))
460 return false;
461 int written =
462 file_util::WriteFile(setup_ex_,
463 reinterpret_cast<const char*>(resource_data.first),
464 static_cast<int>(resource_data.second));
465 if (written != resource_data.second) {
466 LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\"";
467 return false;
468 }
469
470 // Write out chrome.packed.7z
471 if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data))
472 return false;
473 written =
474 file_util::WriteFile(chrome_packed_7z,
475 reinterpret_cast<const char*>(resource_data.first),
476 static_cast<int>(resource_data.second));
477 if (written != resource_data.second) {
478 LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\"";
479 return false;
480 }
481 }
482
483 // Expand setup.ex_
484 FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]);
485 std::wstring command_line;
486 command_line.append(1, L'"')
487 .append(&kExpandExe[0])
488 .append(L"\" \"")
489 .append(setup_ex_.value())
490 .append(L"\" \"")
491 .append(setup_exe.value())
492 .append(1, L'\"');
493 int exit_code;
494 if (!RunProcessAndWait(NULL, command_line, &exit_code))
495 return false;
496 if (exit_code != 0) {
497 LOG(DFATAL) << &kExpandExe[0] << " exited with code " << exit_code;
498 return false;
499 }
500
501 // Unpack chrome.packed.7z
502 std::wstring chrome_7z_name;
503 if (LzmaUtil::UnPackArchive(chrome_packed_7z.value(),
504 work_dir.directory().value(),
505 &chrome_7z_name) != NO_ERROR) {
506 LOG(DFATAL) << "Failed unpacking \"" << chrome_packed_7z.value() << "\"";
507 return false;
508 }
509
510 // Unpack chrome.7z
511 if (LzmaUtil::UnPackArchive(chrome_7z_name, work_dir.directory().value(),
512 NULL) != NO_ERROR) {
513 LOG(DFATAL) << "Failed unpacking \"" << chrome_7z_name << "\"";
514 return false;
515 }
516
517 // Get rid of intermediate files
518 FilePath chrome_7z(chrome_7z_name);
519 if (!file_util::Delete(chrome_7z, false) ||
520 !file_util::Delete(chrome_packed_7z, false) ||
521 !file_util::Delete(setup_ex_, false)) {
522 LOG(DFATAL) << "Failed deleting intermediate files";
523 return false;
524 }
525
526 // Increment the version in all files.
527 ApplyNextVersion(work_dir.directory());
528
529 // Pack up files into chrome.7z
530 if (!CreateArchive(chrome_7z, work_dir.directory().Append(&kChromeBin[0]), 0))
531 return false;
532
533 // Compress chrome.7z into chrome.packed.7z
534 if (!CreateArchive(chrome_packed_7z, chrome_7z, 9))
535 return false;
536
537 // Compress setup.exe into setup.ex_
538 command_line.assign(1, L'"')
539 .append(&kMakeCab[0])
540 .append(L"\" /D CompressionType=LZX /V1 /L \"")
541 .append(work_dir.directory().value())
542 .append(L"\" \"")
543 .append(setup_exe.value());
544 if (!RunProcessAndWait(NULL, command_line, &exit_code))
545 return false;
546 if (exit_code != 0) {
547 LOG(DFATAL) << &kMakeCab[0] << " exited with code " << exit_code;
548 return false;
549 }
550
551 // Replace the mini_installer's setup.ex_ and chrome.packed.7z resources.
552 ResourceUpdater updater;
553 if (!updater.Initialize(mini_installer) ||
554 !updater.Update(&kSetupEx_[0], &kBl[0],
555 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
556 setup_ex_) ||
557 !updater.Update(&kChromePacked7z[0], &kB7[0],
558 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
559 chrome_packed_7z) ||
560 !updater.Commit()) {
561 return false;
562 }
563
564 // Finally, move the updated mini_installer into place.
565 return file_util::Move(mini_installer, target_path);
566 }
567
568 } // namespace upgrade_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698