Chromium Code Reviews| Index: chrome/installer/test/alternate_version_generator.cc |
| =================================================================== |
| --- chrome/installer/test/alternate_version_generator.cc (revision 100136) |
| +++ chrome/installer/test/alternate_version_generator.cc (working copy) |
| @@ -90,6 +90,7 @@ |
| DCHECK(!directory_.empty()); |
| return directory_; |
| } |
| + |
| private: |
| FilePath directory_; |
| DISALLOW_COPY_AND_ASSIGN(ScopedTempDirectory); |
| @@ -336,7 +337,22 @@ |
| (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | |
| base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_READ | |
| base::PLATFORM_FILE_EXCLUSIVE_WRITE), NULL, NULL)); |
| - if (image_handle.Get() != INVALID_HANDLE_VALUE) { |
|
grt (UTC plus 2)
2011/09/12 17:27:15
Greg is a booboo head.
|
| + // It turns out that the underlying CreateFile can fail due to unhelpful |
| + // security software locking the newly created DLL. So add a few brief |
| + // retries to help tests that use this pass on machines thusly encumbered. |
| + int retries = 3; |
| + while (!image_handle.IsValid() && retries-- > 0) { |
| + LOG(WARNING) << "Failed to open \"" << image_file.value() << "\"." |
| + << " Retrying " << retries << " more times."; |
| + Sleep(1000); |
| + image_handle.Set(base::CreatePlatformFile( |
| + image_file, |
| + (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | |
| + base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_READ | |
| + base::PLATFORM_FILE_EXCLUSIVE_WRITE), NULL, NULL)); |
| + } |
| + |
| + if (image_handle.IsValid()) { |
| MappedFile image_mapping; |
| if (image_mapping.Initialize(image_handle)) { |
| base::win::PEImageAsData image( |