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

Unified Diff: base/test/test_timeouts.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « base/test/test_timeouts.h ('k') | base/test/test_ui_thread_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_timeouts.cc
diff --git a/base/test/test_timeouts.cc b/base/test/test_timeouts.cc
deleted file mode 100644
index b30d6c34aac7366f065add222ceea8352dc65abb..0000000000000000000000000000000000000000
--- a/base/test/test_timeouts.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/test/test_timeouts.h"
-
-#include <algorithm>
-
-#include "base/command_line.h"
-#include "base/debug/debugger.h"
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/test/test_switches.h"
-
-namespace {
-
-// ASan/TSan/MSan instrument each memory access. This may slow the execution
-// down significantly.
-#if defined(MEMORY_SANITIZER)
-// For MSan the slowdown depends heavily on the value of msan_track_origins GYP
-// flag. The multiplier below corresponds to msan_track_origins=1.
-static const int kTimeoutMultiplier = 6;
-#elif defined(ADDRESS_SANITIZER) && defined(OS_WIN)
-// Asan/Win has not been optimized yet, give it a higher
-// timeout multiplier. See http://crbug.com/412471
-static const int kTimeoutMultiplier = 3;
-#elif defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || \
- defined(SYZYASAN)
-static const int kTimeoutMultiplier = 2;
-#else
-static const int kTimeoutMultiplier = 1;
-#endif
-
-const int kAlmostInfiniteTimeoutMs = 100000000;
-
-// Sets value to the greatest of:
-// 1) value's current value multiplied by kTimeoutMultiplier (assuming
-// InitializeTimeout is called only once per value).
-// 2) min_value.
-// 3) the numerical value given by switch_name on the command line multiplied
-// by kTimeoutMultiplier.
-void InitializeTimeout(const char* switch_name, int min_value, int* value) {
- DCHECK(value);
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) {
- std::string string_value(base::CommandLine::ForCurrentProcess()->
- GetSwitchValueASCII(switch_name));
- int timeout;
- base::StringToInt(string_value, &timeout);
- *value = std::max(*value, timeout);
- }
- *value *= kTimeoutMultiplier;
- *value = std::max(*value, min_value);
-}
-
-// Sets value to the greatest of:
-// 1) value's current value multiplied by kTimeoutMultiplier.
-// 2) 0
-// 3) the numerical value given by switch_name on the command line multiplied
-// by kTimeoutMultiplier.
-void InitializeTimeout(const char* switch_name, int* value) {
- InitializeTimeout(switch_name, 0, value);
-}
-
-} // namespace
-
-// static
-bool TestTimeouts::initialized_ = false;
-
-// The timeout values should increase in the order they appear in this block.
-// static
-int TestTimeouts::tiny_timeout_ms_ = 100;
-int TestTimeouts::action_timeout_ms_ = 10000;
-#ifndef NDEBUG
-int TestTimeouts::action_max_timeout_ms_ = 45000;
-#else
-int TestTimeouts::action_max_timeout_ms_ = 30000;
-#endif // NDEBUG
-
-int TestTimeouts::test_launcher_timeout_ms_ = 45000;
-
-// static
-void TestTimeouts::Initialize() {
- if (initialized_) {
- NOTREACHED();
- return;
- }
- initialized_ = true;
-
- if (base::debug::BeingDebugged()) {
- fprintf(stdout,
- "Detected presence of a debugger, running without test timeouts.\n");
- }
-
- // Note that these timeouts MUST be initialized in the correct order as
- // per the CHECKS below.
- InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_);
- InitializeTimeout(switches::kUiTestActionTimeout,
- base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs
- : tiny_timeout_ms_,
- &action_timeout_ms_);
- InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_,
- &action_max_timeout_ms_);
-
- // Test launcher timeout is independent from anything above action timeout.
- InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_,
- &test_launcher_timeout_ms_);
-
- // The timeout values should be increasing in the right order.
- CHECK(tiny_timeout_ms_ <= action_timeout_ms_);
- CHECK(action_timeout_ms_ <= action_max_timeout_ms_);
-
- CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_);
-}
« no previous file with comments | « base/test/test_timeouts.h ('k') | base/test/test_ui_thread_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698