test_file_util.cc 636 B

1234567891011121314151617181920212223
  1. // Copyright (c) 2013 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. #include "test/test_file_util.h"
  5. #include "test/test_timeouts.h"
  6. #include "butil/threading/platform_thread.h"
  7. namespace butil {
  8. bool EvictFileFromSystemCacheWithRetry(const FilePath& path) {
  9. const int kCycles = 10;
  10. const TimeDelta kDelay = TestTimeouts::action_timeout() / kCycles;
  11. for (int i = 0; i < kCycles; i++) {
  12. if (EvictFileFromSystemCache(path))
  13. return true;
  14. PlatformThread::Sleep(kDelay);
  15. }
  16. return false;
  17. }
  18. } // namespace butil