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

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

Issue 6482014: Implement sendKeys webdriver API in ChromeDriver. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 #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>
(...skipping 21 matching lines...) Expand all
32 #include "chrome/test/webdriver/commands/create_session.h" 32 #include "chrome/test/webdriver/commands/create_session.h"
33 #include "chrome/test/webdriver/commands/execute_command.h" 33 #include "chrome/test/webdriver/commands/execute_command.h"
34 #include "chrome/test/webdriver/commands/find_element_commands.h" 34 #include "chrome/test/webdriver/commands/find_element_commands.h"
35 #include "chrome/test/webdriver/commands/implicit_wait_command.h" 35 #include "chrome/test/webdriver/commands/implicit_wait_command.h"
36 #include "chrome/test/webdriver/commands/navigate_commands.h" 36 #include "chrome/test/webdriver/commands/navigate_commands.h"
37 #include "chrome/test/webdriver/commands/session_with_id.h" 37 #include "chrome/test/webdriver/commands/session_with_id.h"
38 #include "chrome/test/webdriver/commands/source_command.h" 38 #include "chrome/test/webdriver/commands/source_command.h"
39 #include "chrome/test/webdriver/commands/speed_command.h" 39 #include "chrome/test/webdriver/commands/speed_command.h"
40 #include "chrome/test/webdriver/commands/title_command.h" 40 #include "chrome/test/webdriver/commands/title_command.h"
41 #include "chrome/test/webdriver/commands/url_command.h" 41 #include "chrome/test/webdriver/commands/url_command.h"
42 42 #include "chrome/test/webdriver/commands/value_command.h"
43 #include "third_party/mongoose/mongoose.h" 43 #include "third_party/mongoose/mongoose.h"
44 44
45 // Make sure we have ho zombies from CGIs. 45 // Make sure we have ho zombies from CGIs.
46 static void 46 static void
47 signal_handler(int sig_num) { 47 signal_handler(int sig_num) {
48 switch (sig_num) { 48 switch (sig_num) {
49 #ifdef OS_POSIX 49 #ifdef OS_POSIX
50 case SIGCHLD: 50 case SIGCHLD:
51 while (waitpid(-1, &sig_num, WNOHANG) > 0) { } 51 while (waitpid(-1, &sig_num, WNOHANG) > 0) { }
52 break; 52 break;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 SetCallback<TitleCommand>(ctx, "/session/*/title"); 87 SetCallback<TitleCommand>(ctx, "/session/*/title");
88 SetCallback<URLCommand>(ctx, "/session/*/url"); 88 SetCallback<URLCommand>(ctx, "/session/*/url");
89 SetCallback<SpeedCommand>(ctx, "/session/*/speed"); 89 SetCallback<SpeedCommand>(ctx, "/session/*/speed");
90 SetCallback<ImplicitWaitCommand>(ctx, "/session/*/timeouts/implicit_wait"); 90 SetCallback<ImplicitWaitCommand>(ctx, "/session/*/timeouts/implicit_wait");
91 91
92 // WebElement commands 92 // WebElement commands
93 SetCallback<FindOneElementCommand>(ctx, "/session/*/element"); 93 SetCallback<FindOneElementCommand>(ctx, "/session/*/element");
94 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements"); 94 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements");
95 SetCallback<FindOneElementCommand>(ctx, "/session/*/element/*/element"); 95 SetCallback<FindOneElementCommand>(ctx, "/session/*/element/*/element");
96 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements/*/elements"); 96 SetCallback<FindManyElementsCommand>(ctx, "/session/*/elements/*/elements");
97 SetCallback<ValueCommand>(ctx, "/session/*/element/*/value");
97 98
98 // Since the /session/* is a wild card that would match the above URIs, this 99 // 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. 100 // line MUST be the last registered URI with the server.
100 SetCallback<SessionWithID>(ctx, "/session/*"); 101 SetCallback<SessionWithID>(ctx, "/session/*");
101 } 102 }
103
102 } // namespace webdriver 104 } // namespace webdriver
103 105
104 // Configures mongoose according to the given command line flags. 106 // Configures mongoose according to the given command line flags.
105 // Returns true on success. 107 // Returns true on success.
106 bool SetMongooseOptions(struct mg_context* ctx, 108 bool SetMongooseOptions(struct mg_context* ctx,
107 const std::string& port, 109 const std::string& port,
108 const std::string& root) { 110 const std::string& root) {
109 if (!mg_set_option(ctx, "ports", port.c_str())) { 111 if (!mg_set_option(ctx, "ports", port.c_str())) {
110 std::cout << "ChromeDriver cannot bind to port (" 112 std::cout << "ChromeDriver cannot bind to port ("
111 << port.c_str() << ")" << std::endl; 113 << port.c_str() << ")" << std::endl;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 179
178 // Run until we receive command to shutdown. 180 // Run until we receive command to shutdown.
179 shutdown_event.Wait(); 181 shutdown_event.Wait();
180 182
181 // We should not reach here since the service should never quit. 183 // We should not reach here since the service should never quit.
182 // TODO(jmikhail): register a listener for SIGTERM and break the 184 // TODO(jmikhail): register a listener for SIGTERM and break the
183 // message loop gracefully. 185 // message loop gracefully.
184 mg_stop(ctx); 186 mg_stop(ctx);
185 return (EXIT_SUCCESS); 187 return (EXIT_SUCCESS);
186 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698