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

Side by Side Diff: base/test/test_timeouts.cc

Issue 476543004: Implement unit test specific test launcher timeout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: after disabling Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/test/test_timeouts.h ('k') | media/base/demuxer_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/test/test_timeouts.h" 5 #include "base/test/test_timeouts.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // The timeout values should increase in the order they appear in this block. 65 // The timeout values should increase in the order they appear in this block.
66 // static 66 // static
67 int TestTimeouts::tiny_timeout_ms_ = 100; 67 int TestTimeouts::tiny_timeout_ms_ = 100;
68 int TestTimeouts::action_timeout_ms_ = 10000; 68 int TestTimeouts::action_timeout_ms_ = 10000;
69 #ifndef NDEBUG 69 #ifndef NDEBUG
70 int TestTimeouts::action_max_timeout_ms_ = 45000; 70 int TestTimeouts::action_max_timeout_ms_ = 45000;
71 #else 71 #else
72 int TestTimeouts::action_max_timeout_ms_ = 30000; 72 int TestTimeouts::action_max_timeout_ms_ = 30000;
73 #endif // NDEBUG 73 #endif // NDEBUG
74 74
75 int TestTimeouts::test_launcher_unit_timeout_ms_ = 5000;
75 int TestTimeouts::test_launcher_timeout_ms_ = 45000; 76 int TestTimeouts::test_launcher_timeout_ms_ = 45000;
76 77
77 // static 78 // static
78 void TestTimeouts::Initialize() { 79 void TestTimeouts::Initialize() {
79 if (initialized_) { 80 if (initialized_) {
80 NOTREACHED(); 81 NOTREACHED();
81 return; 82 return;
82 } 83 }
83 initialized_ = true; 84 initialized_ = true;
84 85
85 if (base::debug::BeingDebugged()) { 86 if (base::debug::BeingDebugged()) {
86 fprintf(stdout, 87 fprintf(stdout,
87 "Detected presence of a debugger, running without test timeouts.\n"); 88 "Detected presence of a debugger, running without test timeouts.\n");
88 } 89 }
89 90
90 // Note that these timeouts MUST be initialized in the correct order as 91 // Note that these timeouts MUST be initialized in the correct order as
91 // per the CHECKS below. 92 // per the CHECKS below.
92 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_); 93 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_);
93 InitializeTimeout(switches::kUiTestActionTimeout, 94 InitializeTimeout(switches::kUiTestActionTimeout,
94 base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs 95 base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs
95 : tiny_timeout_ms_, 96 : tiny_timeout_ms_,
96 &action_timeout_ms_); 97 &action_timeout_ms_);
97 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, 98 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_,
98 &action_max_timeout_ms_); 99 &action_max_timeout_ms_);
99 100
100 // Test launcher timeout is independent from anything above action timeout. 101 // Test launcher timeout is independent from anything above action timeout.
101 InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_, 102 InitializeTimeout(switches::kTestLauncherUnitTimeout, action_timeout_ms_,
103 &test_launcher_unit_timeout_ms_);
104 InitializeTimeout(switches::kTestLauncherTimeout,
105 test_launcher_unit_timeout_ms_,
102 &test_launcher_timeout_ms_); 106 &test_launcher_timeout_ms_);
103 107
104 // The timeout values should be increasing in the right order. 108 // The timeout values should be increasing in the right order.
105 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); 109 CHECK(tiny_timeout_ms_ <= action_timeout_ms_);
106 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); 110 CHECK(action_timeout_ms_ <= action_max_timeout_ms_);
107 111
108 CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_); 112 CHECK(action_timeout_ms_ <= test_launcher_unit_timeout_ms_);
113 CHECK(test_launcher_unit_timeout_ms_ <= test_launcher_timeout_ms_);
109 } 114 }
OLDNEW
« no previous file with comments | « base/test/test_timeouts.h ('k') | media/base/demuxer_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698