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

Side by Side Diff: chrome/test/ui/ui_test.cc

Issue 3057033: Remove GetSwitchValue() from chrome/* where easy. (Closed)
Patch Set: finally Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #endif 10 #endif
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 error_msg += L" "; 207 error_msg += L" ";
208 error_msg += kFailedNoCrashService; 208 error_msg += kFailedNoCrashService;
209 } 209 }
210 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg; 210 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg;
211 } 211 }
212 212
213 // Pick up the various test time out values from the command line. 213 // Pick up the various test time out values from the command line.
214 void UITestBase::InitializeTimeouts() { 214 void UITestBase::InitializeTimeouts() {
215 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 215 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
216 if (command_line.HasSwitch(kUiTestTimeout)) { 216 if (command_line.HasSwitch(kUiTestTimeout)) {
217 std::wstring timeout_str = command_line.GetSwitchValue(kUiTestTimeout); 217 std::string timeout_str = command_line.GetSwitchValueASCII(kUiTestTimeout);
218 int timeout; 218 int timeout;
219 base::StringToInt(WideToUTF8(timeout_str), &timeout); 219 base::StringToInt(timeout_str, &timeout);
220 command_execution_timeout_ms_ = std::max(kCommandExecutionTimeout, timeout); 220 command_execution_timeout_ms_ = std::max(kCommandExecutionTimeout, timeout);
221 } 221 }
222 222
223 if (command_line.HasSwitch(kUiTestActionTimeout)) { 223 if (command_line.HasSwitch(kUiTestActionTimeout)) {
224 std::wstring act_str = command_line.GetSwitchValue(kUiTestActionTimeout); 224 std::string act_str =
225 command_line.GetSwitchValueASCII(kUiTestActionTimeout);
225 int act_timeout; 226 int act_timeout;
226 base::StringToInt(WideToUTF8(act_str), &act_timeout); 227 base::StringToInt(act_str, &act_timeout);
227 action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout); 228 action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout);
228 } 229 }
229 230
230 if (command_line.HasSwitch(kUiTestActionMaxTimeout)) { 231 if (command_line.HasSwitch(kUiTestActionMaxTimeout)) {
231 std::wstring action_max_str = 232 std::string action_max_str =
232 command_line.GetSwitchValue(kUiTestActionMaxTimeout); 233 command_line.GetSwitchValueASCII(kUiTestActionMaxTimeout);
233 int max_timeout; 234 int max_timeout;
234 base::StringToInt(WideToUTF8(action_max_str), &max_timeout); 235 base::StringToInt(action_max_str, &max_timeout);
235 action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout); 236 action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout);
236 } 237 }
237 238
238 if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) { 239 if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) {
239 std::wstring sleep_timeout_str = 240 std::string sleep_timeout_str =
240 CommandLine::ForCurrentProcess()->GetSwitchValue(kUiTestSleepTimeout); 241 command_line.GetSwitchValueASCII(kUiTestSleepTimeout);
241 int sleep_timeout; 242 int sleep_timeout;
242 base::StringToInt(WideToUTF8(sleep_timeout_str), &sleep_timeout); 243 base::StringToInt(sleep_timeout_str, &sleep_timeout);
243 sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout); 244 sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout);
244 } 245 }
245 246
246 if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestTerminateTimeout)) { 247 if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestTerminateTimeout)) {
247 std::wstring terminate_timeout_str = 248 std::string terminate_timeout_str =
248 CommandLine::ForCurrentProcess()->GetSwitchValue( 249 command_line.GetSwitchValueASCII(kUiTestTerminateTimeout);
249 kUiTestTerminateTimeout);
250 int terminate_timeout; 250 int terminate_timeout;
251 base::StringToInt(WideToUTF8(terminate_timeout_str), &terminate_timeout); 251 base::StringToInt(terminate_timeout_str, &terminate_timeout);
252 terminate_timeout_ms_ = std::max(kWaitForActionMsec, terminate_timeout); 252 terminate_timeout_ms_ = std::max(kWaitForActionMsec, terminate_timeout);
253 } 253 }
254 } 254 }
255 255
256 AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) { 256 AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) {
257 // By default we create a plain vanilla AutomationProxy. 257 // By default we create a plain vanilla AutomationProxy.
258 return new AutomationProxy(execution_timeout); 258 return new AutomationProxy(execution_timeout);
259 } 259 }
260 260
261 void UITestBase::LaunchBrowserAndServer() { 261 void UITestBase::LaunchBrowserAndServer() {
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 test_info->name()); 1521 test_info->name());
1522 } 1522 }
1523 UITestBase::SetUp(); 1523 UITestBase::SetUp();
1524 PlatformTest::SetUp(); 1524 PlatformTest::SetUp();
1525 } 1525 }
1526 1526
1527 void UITest::TearDown() { 1527 void UITest::TearDown() {
1528 UITestBase::TearDown(); 1528 UITestBase::TearDown();
1529 PlatformTest::TearDown(); 1529 PlatformTest::TearDown();
1530 } 1530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698