OLD | NEW |
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 #ifndef _WIN32 | 7 #ifndef _WIN32 |
8 #include <sys/time.h> | 8 #include <sys/time.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <sys/wait.h> | 10 #include <sys/wait.h> |
11 #else | 11 #else |
12 #include <time.h> | 12 #include <time.h> |
13 #endif | 13 #endif |
14 #include <iostream> | 14 #include <iostream> |
15 #include <fstream> | 15 #include <fstream> |
16 | 16 |
17 #include "base/at_exit.h" | 17 #include "base/at_exit.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/scoped_ptr.h" | 20 #include "base/scoped_ptr.h" |
21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 22 #include "base/threading/platform_thread.h" |
22 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
23 | 24 |
24 #include "chrome/test/webdriver/dispatch.h" | 25 #include "chrome/test/webdriver/dispatch.h" |
25 #include "chrome/test/webdriver/session_manager.h" | 26 #include "chrome/test/webdriver/session_manager.h" |
26 #include "chrome/test/webdriver/utility_functions.h" | 27 #include "chrome/test/webdriver/utility_functions.h" |
27 #include "chrome/test/webdriver/commands/create_session.h" | 28 #include "chrome/test/webdriver/commands/create_session.h" |
28 #include "chrome/test/webdriver/commands/execute_command.h" | 29 #include "chrome/test/webdriver/commands/execute_command.h" |
29 #include "chrome/test/webdriver/commands/find_element_commands.h" | 30 #include "chrome/test/webdriver/commands/find_element_commands.h" |
30 #include "chrome/test/webdriver/commands/implicit_wait_command.h" | 31 #include "chrome/test/webdriver/commands/implicit_wait_command.h" |
31 #include "chrome/test/webdriver/commands/navigate_commands.h" | 32 #include "chrome/test/webdriver/commands/navigate_commands.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Listen on port 9515 or port specified on command line. | 123 // Listen on port 9515 or port specified on command line. |
123 // TODO(jmikhail) Maybe add port 9516 as a secure connection. | 124 // TODO(jmikhail) Maybe add port 9516 as a secure connection. |
124 ctx = mg_start(); | 125 ctx = mg_start(); |
125 mg_set_option(ctx, "ports", port.c_str()); | 126 mg_set_option(ctx, "ports", port.c_str()); |
126 | 127 |
127 webdriver::InitCallbacks(ctx); | 128 webdriver::InitCallbacks(ctx); |
128 | 129 |
129 std::cout << "Starting server on port: " << port << std::endl; | 130 std::cout << "Starting server on port: " << port << std::endl; |
130 // The default behavior is to run this service forever. | 131 // The default behavior is to run this service forever. |
131 while (true) | 132 while (true) |
132 PlatformThread::Sleep(3600); | 133 base::PlatformThread::Sleep(3600); |
133 | 134 |
134 // We should not reach here since the service should never quit. | 135 // We should not reach here since the service should never quit. |
135 // TODO(jmikhail): register a listener for SIGTERM and break the | 136 // TODO(jmikhail): register a listener for SIGTERM and break the |
136 // message loop gracefully. | 137 // message loop gracefully. |
137 mg_stop(ctx); | 138 mg_stop(ctx); |
138 return (EXIT_SUCCESS); | 139 return (EXIT_SUCCESS); |
139 } | 140 } |
140 | 141 |
OLD | NEW |