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: chrome/test/automation/proxy_launcher.cc

Issue 7519028: Remove some unneeded uses of wstring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/ui/ui_test.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 "chrome/test/automation/proxy_launcher.h" 5 #include "chrome/test/automation/proxy_launcher.h"
6 6
7 #include "base/environment.h" 7 #include "base/environment.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 void ProxyLauncher::CloseBrowserAndServer() { 138 void ProxyLauncher::CloseBrowserAndServer() {
139 QuitBrowser(); 139 QuitBrowser();
140 140
141 // Suppress spammy failures that seem to be occurring when running 141 // Suppress spammy failures that seem to be occurring when running
142 // the UI tests in single-process mode. 142 // the UI tests in single-process mode.
143 // TODO(jhughes): figure out why this is necessary at all, and fix it 143 // TODO(jhughes): figure out why this is necessary at all, and fix it
144 if (!in_process_renderer_) 144 if (!in_process_renderer_)
145 AssertAppNotRunning( 145 AssertAppNotRunning(
146 StringPrintf(L"Unable to quit all browser processes. Original PID %d", 146 StringPrintf("Unable to quit all browser processes. Original PID %d",
147 &process_id_)); 147 process_id_));
148 148
149 DisconnectFromRunningBrowser(); 149 DisconnectFromRunningBrowser();
150 } 150 }
151 151
152 void ProxyLauncher::DisconnectFromRunningBrowser() { 152 void ProxyLauncher::DisconnectFromRunningBrowser() {
153 automation_proxy_.reset(); // Shut down IPC testing interface. 153 automation_proxy_.reset(); // Shut down IPC testing interface.
154 } 154 }
155 155
156 bool ProxyLauncher::LaunchBrowser(const LaunchState& state) { 156 bool ProxyLauncher::LaunchBrowser(const LaunchState& state) {
157 if (state.clear_profile || !temp_profile_dir_.IsValid()) { 157 if (state.clear_profile || !temp_profile_dir_.IsValid()) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 #endif // OS_POSIX 297 #endif // OS_POSIX
298 298
299 int exit_code = -1; 299 int exit_code = -1;
300 EXPECT_TRUE(WaitForBrowserProcessToQuit( 300 EXPECT_TRUE(WaitForBrowserProcessToQuit(
301 TestTimeouts::action_max_timeout_ms(), &exit_code)); 301 TestTimeouts::action_max_timeout_ms(), &exit_code));
302 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. 302 EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
303 303
304 browser_quit_time_ = base::TimeTicks::Now() - quit_start; 304 browser_quit_time_ = base::TimeTicks::Now() - quit_start;
305 } 305 }
306 306
307 void ProxyLauncher::AssertAppNotRunning(const std::wstring& error_message) { 307 void ProxyLauncher::AssertAppNotRunning(const std::string& error_message) {
308 std::wstring final_error_message(error_message); 308 std::string final_error_message(error_message);
309 309
310 ChromeProcessList processes = GetRunningChromeProcesses(process_id_); 310 ChromeProcessList processes = GetRunningChromeProcesses(process_id_);
311 if (!processes.empty()) { 311 if (!processes.empty()) {
312 final_error_message += L" Leftover PIDs: ["; 312 final_error_message += " Leftover PIDs: [";
313 for (ChromeProcessList::const_iterator it = processes.begin(); 313 for (ChromeProcessList::const_iterator it = processes.begin();
314 it != processes.end(); ++it) { 314 it != processes.end(); ++it) {
315 final_error_message += StringPrintf(L" %d", *it); 315 final_error_message += StringPrintf(" %d", *it);
316 } 316 }
317 final_error_message += L" ]"; 317 final_error_message += " ]";
318 } 318 }
319 ASSERT_TRUE(processes.empty()) << final_error_message; 319 ASSERT_TRUE(processes.empty()) << final_error_message;
320 } 320 }
321 321
322 bool ProxyLauncher::WaitForBrowserProcessToQuit(int timeout, int* exit_code) { 322 bool ProxyLauncher::WaitForBrowserProcessToQuit(int timeout, int* exit_code) {
323 #ifdef WAIT_FOR_DEBUGGER_ON_OPEN 323 #ifdef WAIT_FOR_DEBUGGER_ON_OPEN
324 timeout = 500000; 324 timeout = 500000;
325 #endif 325 #endif
326 bool success = base::WaitForExitCodeWithTimeout(process_, exit_code, timeout); 326 bool success = base::WaitForExitCodeWithTimeout(process_, exit_code, timeout);
327 327
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads)); 580 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads));
581 } 581 }
582 582
583 void AnonymousProxyLauncher::TerminateConnection() { 583 void AnonymousProxyLauncher::TerminateConnection() {
584 CloseBrowserAndServer(); 584 CloseBrowserAndServer();
585 } 585 }
586 586
587 std::string AnonymousProxyLauncher::PrefixedChannelID() const { 587 std::string AnonymousProxyLauncher::PrefixedChannelID() const {
588 return channel_id_; 588 return channel_id_;
589 } 589 }
OLDNEW
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/ui/ui_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698