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

Side by Side Diff: chrome/test/webdriver/server.cc

Issue 5572001: Send screenshots back to the client for debugging (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixed function names and migrated code to new desktop Created 9 years, 9 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
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 <signal.h> 5 #include <signal.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // By default, mongoose serves files from the current working directory. The 187 // By default, mongoose serves files from the current working directory. The
188 // 'root' flag allows the user to specify a different location to serve from. 188 // 'root' flag allows the user to specify a different location to serve from.
189 if (cmd_line->HasSwitch("root")) 189 if (cmd_line->HasSwitch("root"))
190 root = cmd_line->GetSwitchValueASCII("root"); 190 root = cmd_line->GetSwitchValueASCII("root");
191 if (cmd_line->HasSwitch("chrome-dir")) 191 if (cmd_line->HasSwitch("chrome-dir"))
192 chrome_dir = cmd_line->GetSwitchValuePath("chrome-dir"); 192 chrome_dir = cmd_line->GetSwitchValuePath("chrome-dir");
193 if (cmd_line->HasSwitch("url-base")) 193 if (cmd_line->HasSwitch("url-base"))
194 url_base = cmd_line->GetSwitchValueASCII("url-base"); 194 url_base = cmd_line->GetSwitchValueASCII("url-base");
195 195
196 webdriver::SessionManager* manager = webdriver::SessionManager::GetInstance(); 196 webdriver::SessionManager* manager = webdriver::SessionManager::GetInstance();
197 manager->set_port(port); 197 manager->SetPort(port);
198 manager->set_url_base(url_base); 198 manager->SetUrlBase(url_base);
199 manager->SetScreenshotOnError(cmd_line->HasSwitch("screenshot-on-error"));
199 if (!chrome_dir.empty()) { 200 if (!chrome_dir.empty()) {
200 if (!file_util::DirectoryExists(chrome_dir)) { 201 if (!file_util::DirectoryExists(chrome_dir)) {
201 std::cout << "Given Chrome directory is inaccessible or does not exist: " 202 std::cout << "Given Chrome directory is inaccessible or does not exist: "
202 << chrome_dir.value() << std::endl; 203 << chrome_dir.value() << std::endl;
203 #if defined(OS_WIN) 204 #if defined(OS_WIN)
204 return ERROR_PATH_NOT_FOUND; 205 return ERROR_PATH_NOT_FOUND;
205 #else 206 #else
206 return ENOENT; 207 return ENOENT;
207 #endif 208 #endif
208 } 209 }
209 manager->set_chrome_dir(chrome_dir); 210 manager->SetChromeDir(chrome_dir);
210 } 211 }
211 212
212 // Initialize SHTTPD context. 213 // Initialize SHTTPD context.
213 // Listen on port 9515 or port specified on command line. 214 // Listen on port 9515 or port specified on command line.
214 // TODO(jmikhail) Maybe add port 9516 as a secure connection. 215 // TODO(jmikhail) Maybe add port 9516 as a secure connection.
215 ctx = mg_start(); 216 ctx = mg_start();
216 if (!SetMongooseOptions(ctx, port, root)) { 217 if (!SetMongooseOptions(ctx, port, root)) {
217 mg_stop(ctx); 218 mg_stop(ctx);
218 #if defined(OS_WIN) 219 #if defined(OS_WIN)
219 return WSAEADDRINUSE; 220 return WSAEADDRINUSE;
(...skipping 19 matching lines...) Expand all
239 240
240 // Run until we receive command to shutdown. 241 // Run until we receive command to shutdown.
241 shutdown_event.Wait(); 242 shutdown_event.Wait();
242 243
243 // We should not reach here since the service should never quit. 244 // We should not reach here since the service should never quit.
244 // TODO(jmikhail): register a listener for SIGTERM and break the 245 // TODO(jmikhail): register a listener for SIGTERM and break the
245 // message loop gracefully. 246 // message loop gracefully.
246 mg_stop(ctx); 247 mg_stop(ctx);
247 return (EXIT_SUCCESS); 248 return (EXIT_SUCCESS);
248 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698