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

Side by Side Diff: chrome/test/webdriver/automation.h

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
« no previous file with comments | « chrome/test/webdriver/WEBDRIVER_TESTS ('k') | chrome/test/webdriver/automation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_TEST_WEBDRIVER_AUTOMATION_H_ 5 #ifndef CHROME_TEST_WEBDRIVER_AUTOMATION_H_
6 #define CHROME_TEST_WEBDRIVER_AUTOMATION_H_ 6 #define CHROME_TEST_WEBDRIVER_AUTOMATION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/task.h" 10 #include "base/task.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "chrome/common/automation_constants.h"
13 #include "chrome/test/ui/ui_test.h" 14 #include "chrome/test/ui/ui_test.h"
15 #include "ui/base/keycodes/keyboard_codes.h"
14 16
15 namespace webdriver { 17 namespace webdriver {
16 18
19 struct WebKeyEvent {
20 WebKeyEvent(automation::KeyEventTypes type,
21 ui::KeyboardCode key_code,
22 const std::string& unmodified_text,
23 const std::string& modified_text,
24 int modifiers)
25 : type(type),
26 key_code(key_code),
27 unmodified_text(unmodified_text),
28 modified_text(modified_text),
29 modifiers(modifiers) {}
30
31 automation::KeyEventTypes type;
32 ui::KeyboardCode key_code;
33 std::string unmodified_text;
34 std::string modified_text;
35 int modifiers;
36 };
37
17 // Creates and controls the Chrome instance. 38 // Creates and controls the Chrome instance.
18 // This class should be created and accessed on a single thread. 39 // This class should be created and accessed on a single thread.
19 // TODO(phajdan.jr): Abstract UITestBase classes, see: 40 // TODO(phajdan.jr): Abstract UITestBase classes, see:
20 // http://code.google.com/p/chromium/issues/detail?id=56865 41 // http://code.google.com/p/chromium/issues/detail?id=56865
21 class Automation : private UITestBase { 42 class Automation : private UITestBase {
22 public: 43 public:
23 Automation(); 44 Automation();
24 virtual ~Automation(); 45 virtual ~Automation();
25 46
26 // Creates a browser. 47 // Creates a browser.
27 void Init(bool* success); 48 void Init(bool* success);
28 49
29 // Terminates this session and disconnects its automation proxy. After 50 // Terminates this session and disconnects its automation proxy. After
30 // invoking this method, the Automation can safely be deleted. 51 // invoking this method, the Automation can safely be deleted.
31 void Terminate(); 52 void Terminate();
32 53
33 // Executes the given |script| in the specified frame of the current 54 // Executes the given |script| in the specified frame of the current
34 // tab. |result| will be set to the JSON result. Returns true on success. 55 // tab. |result| will be set to the JSON result. Returns true on success.
35 void ExecuteScript(const std::string& frame_xpath, 56 void ExecuteScript(const std::string& frame_xpath,
36 const std::string& script, 57 const std::string& script,
37 std::string* result, 58 std::string* result,
38 bool* success); 59 bool* success);
39 60
61 // Sends a key event to the current browser. Waits until the key has
62 // been processed by the web page.
63 void SendWebKeyEvent(const WebKeyEvent& key_event, bool* success);
64
40 void NavigateToURL(const std::string& url, bool* success); 65 void NavigateToURL(const std::string& url, bool* success);
41 void GoForward(bool* success); 66 void GoForward(bool* success);
42 void GoBack(bool* success); 67 void GoBack(bool* success);
43 void Reload(bool* success); 68 void Reload(bool* success);
44 void GetURL(std::string* url, bool* success); 69 void GetURL(std::string* url, bool* success);
45 void GetTabTitle(std::string* tab_title, bool* success); 70 void GetTabTitle(std::string* tab_title, bool* success);
46 71
47 private: 72 private:
48 scoped_refptr<BrowserProxy> browser_; 73 scoped_refptr<BrowserProxy> browser_;
49 scoped_refptr<TabProxy> tab_; 74 scoped_refptr<TabProxy> tab_;
50 75
51 ScopedTempDir profile_dir_; 76 ScopedTempDir profile_dir_;
52 77
53 DISALLOW_COPY_AND_ASSIGN(Automation); 78 DISALLOW_COPY_AND_ASSIGN(Automation);
54 }; 79 };
55 80
56 } // namespace webdriver 81 } // namespace webdriver
57 82
58 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); 83 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation);
59 84
60 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ 85 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_
OLDNEW
« no previous file with comments | « chrome/test/webdriver/WEBDRIVER_TESTS ('k') | chrome/test/webdriver/automation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698