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/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
21 #include "base/scoped_ptr.h" | 21 #include "base/scoped_ptr.h" |
22 #include "base/string_split.h" | 22 #include "base/string_split.h" |
23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
24 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
25 #include "base/test/test_timeouts.h" | 25 #include "base/test/test_timeouts.h" |
26 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
27 #include "base/utf_string_conversions.h" | 27 #include "base/utf_string_conversions.h" |
28 | |
kkania
2011/02/09 16:53:13
no newline here
| |
28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/test/webdriver/dispatch.h" | 30 #include "chrome/test/webdriver/dispatch.h" |
30 #include "chrome/test/webdriver/session_manager.h" | 31 #include "chrome/test/webdriver/session_manager.h" |
31 #include "chrome/test/webdriver/utility_functions.h" | 32 #include "chrome/test/webdriver/utility_functions.h" |
33 #include "chrome/test/webdriver/commands/cookie_commands.h" | |
32 #include "chrome/test/webdriver/commands/create_session.h" | 34 #include "chrome/test/webdriver/commands/create_session.h" |
33 #include "chrome/test/webdriver/commands/execute_command.h" | 35 #include "chrome/test/webdriver/commands/execute_command.h" |
34 #include "chrome/test/webdriver/commands/find_element_commands.h" | 36 #include "chrome/test/webdriver/commands/find_element_commands.h" |
35 #include "chrome/test/webdriver/commands/implicit_wait_command.h" | 37 #include "chrome/test/webdriver/commands/implicit_wait_command.h" |
36 #include "chrome/test/webdriver/commands/navigate_commands.h" | 38 #include "chrome/test/webdriver/commands/navigate_commands.h" |
37 #include "chrome/test/webdriver/commands/session_with_id.h" | 39 #include "chrome/test/webdriver/commands/session_with_id.h" |
38 #include "chrome/test/webdriver/commands/source_command.h" | 40 #include "chrome/test/webdriver/commands/source_command.h" |
39 #include "chrome/test/webdriver/commands/speed_command.h" | 41 #include "chrome/test/webdriver/commands/speed_command.h" |
40 #include "chrome/test/webdriver/commands/title_command.h" | 42 #include "chrome/test/webdriver/commands/title_command.h" |
41 #include "chrome/test/webdriver/commands/url_command.h" | 43 #include "chrome/test/webdriver/commands/url_command.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 SetCallback<BackCommand>(ctx, "/session/*/back"); | 84 SetCallback<BackCommand>(ctx, "/session/*/back"); |
83 SetCallback<ExecuteCommand>(ctx, "/session/*/execute"); | 85 SetCallback<ExecuteCommand>(ctx, "/session/*/execute"); |
84 SetCallback<ForwardCommand>(ctx, "/session/*/forward"); | 86 SetCallback<ForwardCommand>(ctx, "/session/*/forward"); |
85 SetCallback<RefreshCommand>(ctx, "/session/*/refresh"); | 87 SetCallback<RefreshCommand>(ctx, "/session/*/refresh"); |
86 SetCallback<SourceCommand>(ctx, "/session/*/source"); | 88 SetCallback<SourceCommand>(ctx, "/session/*/source"); |
87 SetCallback<TitleCommand>(ctx, "/session/*/title"); | 89 SetCallback<TitleCommand>(ctx, "/session/*/title"); |
88 SetCallback<URLCommand>(ctx, "/session/*/url"); | 90 SetCallback<URLCommand>(ctx, "/session/*/url"); |
89 SetCallback<SpeedCommand>(ctx, "/session/*/speed"); | 91 SetCallback<SpeedCommand>(ctx, "/session/*/speed"); |
90 SetCallback<ImplicitWaitCommand>(ctx, "/session/*/timeouts/implicit_wait"); | 92 SetCallback<ImplicitWaitCommand>(ctx, "/session/*/timeouts/implicit_wait"); |
91 | 93 |
94 // Cookie functions. | |
95 SetCallback<CookieCommand>(ctx, "/session/*/cookie"); | |
96 SetCallback<NamedCookieCommand>(ctx, "/session/*/cookie/*"); | |
97 | |
92 // WebElement commands | 98 // WebElement commands |
93 SetCallback<FindOneElementCommand>(ctx, "/session/*/element"); | 99 SetCallback<FindOneElementCommand>(ctx, "/session/*/element"); |
94 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements"); | 100 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements"); |
95 SetCallback<FindOneElementCommand>(ctx, "/session/*/element/*/element"); | 101 SetCallback<FindOneElementCommand>(ctx, "/session/*/element/*/element"); |
96 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements/*/elements"); | 102 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements/*/elements"); |
97 | 103 |
98 // Since the /session/* is a wild card that would match the above URIs, this | 104 // Since the /session/* is a wild card that would match the above URIs, this |
99 // line MUST be the last registered URI with the server. | 105 // line MUST be the last registered URI with the server. |
100 SetCallback<SessionWithID>(ctx, "/session/*"); | 106 SetCallback<SessionWithID>(ctx, "/session/*"); |
101 } | 107 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 | 183 |
178 // Run until we receive command to shutdown. | 184 // Run until we receive command to shutdown. |
179 shutdown_event.Wait(); | 185 shutdown_event.Wait(); |
180 | 186 |
181 // We should not reach here since the service should never quit. | 187 // We should not reach here since the service should never quit. |
182 // TODO(jmikhail): register a listener for SIGTERM and break the | 188 // TODO(jmikhail): register a listener for SIGTERM and break the |
183 // message loop gracefully. | 189 // message loop gracefully. |
184 mg_stop(ctx); | 190 mg_stop(ctx); |
185 return (EXIT_SUCCESS); | 191 return (EXIT_SUCCESS); |
186 } | 192 } |
OLD | NEW |