Skip to content

Commit

Permalink
Fix startup_test failures on Windows buildbot.
Browse files Browse the repository at this point in the history
The problem seems to be an error when overwriting file which is in use
(that's how EvictFileFromSystemCache works on Windows). So I used
a standard workaround for such Windowsic problems and created a wrapper
which retries 10 times. Similar code was there before my porting patch.

TBR=agl

Review URL: http://codereview.chromium.org/40160

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10981 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
phajdan.jr@chromium.org committed Mar 5, 2009
1 parent ac5815e commit 6390be3
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions chrome/test/startup/startup_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ using base::TimeTicks;

namespace {

// Wrapper around EvictFileFromSystemCache to retry 10 times in case of error.
// Apparently needed for Windows buildbots (to workaround an error when
// file is in use).
// TODO(phajdan.jr): Move to test_file_util if we need it in more places.
bool EvictFileFromSystemCacheWrapper(const FilePath& path) {
for (int i = 0; i < 10; i++) {
if (file_util::EvictFileFromSystemCache(path))
return true;
PlatformThread::Sleep(1000);
}
return false;
}

class StartupTest : public UITest {
public:
StartupTest() {
Expand All @@ -40,17 +53,17 @@ class StartupTest : public UITest {

FilePath chrome_exe(dir_app.Append(
FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName)));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(chrome_exe));
ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_exe));
#if defined(OS_WIN)
// TODO(port): these files do not exist on other platforms.
// Decide what to do.

FilePath chrome_dll(dir_app.Append(FILE_PATH_LITERAL("chrome.dll")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(chrome_dll));
ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_dll));

FilePath gears_dll;
ASSERT_TRUE(PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_dll));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(gears_dll));
ASSERT_TRUE(EvictFileFromSystemCacheWrapper(gears_dll));
#endif // defined(OS_WIN)
}

Expand Down

0 comments on commit 6390be3

Please sign in to comment.