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

Unified Diff: chrome/test/startup/startup_test.cc

Issue 40160: Fix startup_test failures on Windows buildbot. (Closed)
Patch Set: Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/startup/startup_test.cc
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index a07769ddd4d646ff0ad91ae7932d072534da267c..9fedf529042d75523bc30ea7b94b279721a9c4c3 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)
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698