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/threading/platform_thread.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 | 24 |
25 #include "chrome/test/webdriver/dispatch.h" | 25 #include "chrome/test/webdriver/dispatch.h" |
26 #include "chrome/test/webdriver/session_manager.h" | 26 #include "chrome/test/webdriver/session_manager.h" |
27 #include "chrome/test/webdriver/utility_functions.h" | 27 #include "chrome/test/webdriver/utility_functions.h" |
| 28 #include "chrome/test/webdriver/commands/cookie_commands.h" |
28 #include "chrome/test/webdriver/commands/create_session.h" | 29 #include "chrome/test/webdriver/commands/create_session.h" |
29 #include "chrome/test/webdriver/commands/execute_command.h" | 30 #include "chrome/test/webdriver/commands/execute_command.h" |
30 #include "chrome/test/webdriver/commands/find_element_commands.h" | 31 #include "chrome/test/webdriver/commands/find_element_commands.h" |
31 #include "chrome/test/webdriver/commands/implicit_wait_command.h" | 32 #include "chrome/test/webdriver/commands/implicit_wait_command.h" |
32 #include "chrome/test/webdriver/commands/navigate_commands.h" | 33 #include "chrome/test/webdriver/commands/navigate_commands.h" |
33 #include "chrome/test/webdriver/commands/session_with_id.h" | 34 #include "chrome/test/webdriver/commands/session_with_id.h" |
34 #include "chrome/test/webdriver/commands/source_command.h" | 35 #include "chrome/test/webdriver/commands/source_command.h" |
35 #include "chrome/test/webdriver/commands/speed_command.h" | 36 #include "chrome/test/webdriver/commands/speed_command.h" |
36 #include "chrome/test/webdriver/commands/title_command.h" | 37 #include "chrome/test/webdriver/commands/title_command.h" |
37 #include "chrome/test/webdriver/commands/url_command.h" | 38 #include "chrome/test/webdriver/commands/url_command.h" |
(...skipping 26 matching lines...) Expand all Loading... |
64 SetCallback<CreateSession>(ctx, "/session"); | 65 SetCallback<CreateSession>(ctx, "/session"); |
65 SetCallback<BackCommand>(ctx, "/session/*/back"); | 66 SetCallback<BackCommand>(ctx, "/session/*/back"); |
66 SetCallback<ExecuteCommand>(ctx, "/session/*/execute"); | 67 SetCallback<ExecuteCommand>(ctx, "/session/*/execute"); |
67 SetCallback<ForwardCommand>(ctx, "/session/*/forward"); | 68 SetCallback<ForwardCommand>(ctx, "/session/*/forward"); |
68 SetCallback<RefreshCommand>(ctx, "/session/*/refresh"); | 69 SetCallback<RefreshCommand>(ctx, "/session/*/refresh"); |
69 SetCallback<SourceCommand>(ctx, "/session/*/source"); | 70 SetCallback<SourceCommand>(ctx, "/session/*/source"); |
70 SetCallback<TitleCommand>(ctx, "/session/*/title"); | 71 SetCallback<TitleCommand>(ctx, "/session/*/title"); |
71 SetCallback<URLCommand>(ctx, "/session/*/url"); | 72 SetCallback<URLCommand>(ctx, "/session/*/url"); |
72 SetCallback<SpeedCommand>(ctx, "/session/*/speed"); | 73 SetCallback<SpeedCommand>(ctx, "/session/*/speed"); |
73 | 74 |
| 75 // Cookie functions. |
| 76 SetCallback<CookieCommand>(ctx, "/session/*/cookie"); |
| 77 SetCallback<NamedCookieCommand>(ctx, "/session/*/cookie/*"); |
| 78 |
74 // WebElement commands | 79 // WebElement commands |
75 SetCallback<ImplicitWaitCommand>(ctx, "/session/*/timeouts/implicit_wait"); | 80 SetCallback<ImplicitWaitCommand>(ctx, "/session/*/timeouts/implicit_wait"); |
76 SetCallback<FindOneElementCommand>(ctx, "/session/*/element"); | 81 SetCallback<FindOneElementCommand>(ctx, "/session/*/element"); |
77 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements"); | 82 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements"); |
78 SetCallback<FindOneElementCommand>(ctx, "/session/*/element/*/element"); | 83 SetCallback<FindOneElementCommand>(ctx, "/session/*/element/*/element"); |
79 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements/*/elements"); | 84 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements/*/elements"); |
80 | 85 |
81 // Since the /session/* is a wild card that would match the above URIs, this | 86 // Since the /session/* is a wild card that would match the above URIs, this |
82 // line MUST be the last registered URI with the server. | 87 // line MUST be the last registered URI with the server. |
83 SetCallback<SessionWithID>(ctx, "/session/*"); | 88 SetCallback<SessionWithID>(ctx, "/session/*"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 while (true) | 137 while (true) |
133 base::PlatformThread::Sleep(3600); | 138 base::PlatformThread::Sleep(3600); |
134 | 139 |
135 // We should not reach here since the service should never quit. | 140 // We should not reach here since the service should never quit. |
136 // TODO(jmikhail): register a listener for SIGTERM and break the | 141 // TODO(jmikhail): register a listener for SIGTERM and break the |
137 // message loop gracefully. | 142 // message loop gracefully. |
138 mg_stop(ctx); | 143 mg_stop(ctx); |
139 return (EXIT_SUCCESS); | 144 return (EXIT_SUCCESS); |
140 } | 145 } |
141 | 146 |
OLD | NEW |