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

Side by Side Diff: chrome/test/test_launcher_utils.cc

Issue 7104059: Revert 88111 - GTTF: Move --test-terminate-timeout logic to base/test/test_timeouts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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.cc ('k') | no next file » | 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "chrome/common/chrome_paths.h" 11 #include "chrome/common/chrome_paths.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/test_launcher_utils.h" 13 #include "chrome/test/test_launcher_utils.h"
14 #include "ui/gfx/gl/gl_switches.h" 14 #include "ui/gfx/gl/gl_switches.h"
15 15
16 namespace { 16 namespace {
17 17
18 // TODO(phajdan.jr): remove this flag and fix its users.
19 // We should use base/test/test_timeouts and not custom flags.
20 static const char kTestTerminateTimeoutFlag[] = "test-terminate-timeout";
21
18 // A multiplier for slow tests. We generally avoid multiplying 22 // A multiplier for slow tests. We generally avoid multiplying
19 // test timeouts by any constants. Here it is used as last resort 23 // test timeouts by any constants. Here it is used as last resort
20 // to implement the SLOW_ test prefix. 24 // to implement the SLOW_ test prefix.
21 static const int kSlowTestTimeoutMultiplier = 5; 25 static const int kSlowTestTimeoutMultiplier = 5;
22 26
23 } // namespace 27 } // namespace
24 28
25 namespace test_launcher_utils { 29 namespace test_launcher_utils {
26 30
27 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { 31 void PrepareBrowserCommandLineForTests(CommandLine* command_line) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return false; 87 return false;
84 88
85 command_line->AppendSwitchASCII(switches::kUseGL, implementation_name); 89 command_line->AppendSwitchASCII(switches::kUseGL, implementation_name);
86 90
87 return true; 91 return true;
88 } 92 }
89 93
90 int GetTestTerminationTimeout(const std::string& test_name, 94 int GetTestTerminationTimeout(const std::string& test_name,
91 int default_timeout_ms) { 95 int default_timeout_ms) {
92 int timeout_ms = default_timeout_ms; 96 int timeout_ms = default_timeout_ms;
97 if (CommandLine::ForCurrentProcess()->HasSwitch(kTestTerminateTimeoutFlag)) {
98 std::string timeout_str =
99 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
100 kTestTerminateTimeoutFlag);
101 int timeout;
102 if (base::StringToInt(timeout_str, &timeout)) {
103 timeout_ms = std::max(timeout_ms, timeout);
104 } else {
105 LOG(ERROR) << "Invalid timeout (" << kTestTerminateTimeoutFlag << "): "
106 << timeout_str;
107 }
108 }
93 109
94 // Make it possible for selected tests to request a longer timeout. 110 // Make it possible for selected tests to request a longer timeout.
95 // Generally tests should really avoid doing too much, and splitting 111 // Generally tests should really avoid doing too much, and splitting
96 // a test instead of using SLOW prefix is strongly preferred. 112 // a test instead of using SLOW prefix is strongly preferred.
97 if (test_name.find("SLOW_") != std::string::npos) 113 if (test_name.find("SLOW_") != std::string::npos)
98 timeout_ms *= kSlowTestTimeoutMultiplier; 114 timeout_ms *= kSlowTestTimeoutMultiplier;
99 115
100 return timeout_ms; 116 return timeout_ms;
101 } 117 }
102 118
103 } // namespace test_launcher_utils 119 } // namespace test_launcher_utils
OLDNEW
« no previous file with comments | « base/test/test_timeouts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698