summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 12:14:05 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 12:14:05 +0000
commit6390be368205705f49ead3cec40396519f13b889 (patch)
tree46413dca9f0288a22cffbc415f85d7648eb8440c /chrome/test
parentac5815ee2f99c89d726dacf7053a8416d78d8841 (diff)
downloadchromium_src-6390be368205705f49ead3cec40396519f13b889.zip
chromium_src-6390be368205705f49ead3cec40396519f13b889.tar.gz
chromium_src-6390be368205705f49ead3cec40396519f13b889.tar.bz2
Fix startup_test failures on Windows buildbot.
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
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/startup/startup_test.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index a07769d..9fedf52 100644
--- a/chrome/test/startup/startup_test.cc
+++ b/chrome/test/startup/startup_test.cc
@@ -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() {
@@ -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)
}