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

Side by Side Diff: chrome/test/webdriver/commands/mouse_commands.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 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_COMMANDS_MOUSE_COMMANDS_H_ 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_MOUSE_COMMANDS_H_
6 #define CHROME_TEST_WEBDRIVER_COMMANDS_MOUSE_COMMANDS_H_ 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_MOUSE_COMMANDS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/test/webdriver/commands/webelement_commands.h" 11 #include "chrome/test/webdriver/commands/webelement_commands.h"
12 #include "chrome/test/webdriver/web_element_id.h" 12 #include "chrome/test/webdriver/web_element_id.h"
13 13
14 namespace base {
14 class DictionaryValue; 15 class DictionaryValue;
16 }
15 17
16 namespace gfx { 18 namespace gfx {
17 class Point; 19 class Point;
18 } 20 }
19 21
20 namespace webdriver { 22 namespace webdriver {
21 23
22 class Error; 24 class Error;
23 class Response; 25 class Response;
24 26
25 // Click an element. See: 27 // Click an element. See:
26 // http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/We bElement.html#click() 28 // http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/We bElement.html#click()
27 class MoveAndClickCommand : public WebElementCommand { 29 class MoveAndClickCommand : public WebElementCommand {
28 public: 30 public:
29 MoveAndClickCommand(const std::vector<std::string>& path_segments, 31 MoveAndClickCommand(const std::vector<std::string>& path_segments,
30 const DictionaryValue* const parameters); 32 const base::DictionaryValue* const parameters);
31 virtual ~MoveAndClickCommand(); 33 virtual ~MoveAndClickCommand();
32 34
33 virtual bool DoesPost(); 35 virtual bool DoesPost();
34 virtual void ExecutePost(Response* const response); 36 virtual void ExecutePost(Response* const response);
35 37
36 private: 38 private:
37 DISALLOW_COPY_AND_ASSIGN(MoveAndClickCommand); 39 DISALLOW_COPY_AND_ASSIGN(MoveAndClickCommand);
38 }; 40 };
39 41
40 // Move the mouse over an element. See: 42 // Move the mouse over an element. See:
41 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/hover 43 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/hover
42 class HoverCommand : public WebElementCommand { 44 class HoverCommand : public WebElementCommand {
43 public: 45 public:
44 HoverCommand(const std::vector<std::string>& path_segments, 46 HoverCommand(const std::vector<std::string>& path_segments,
45 const DictionaryValue* const parameters); 47 const base::DictionaryValue* const parameters);
46 virtual ~HoverCommand(); 48 virtual ~HoverCommand();
47 49
48 virtual bool DoesPost(); 50 virtual bool DoesPost();
49 virtual void ExecutePost(Response* const response); 51 virtual void ExecutePost(Response* const response);
50 52
51 private: 53 private:
52 DISALLOW_COPY_AND_ASSIGN(HoverCommand); 54 DISALLOW_COPY_AND_ASSIGN(HoverCommand);
53 }; 55 };
54 56
55 // Drag and drop an element. The distance to drag an element should be 57 // Drag and drop an element. The distance to drag an element should be
56 // specified relative to the upper-left corner of the page. See: 58 // specified relative to the upper-left corner of the page. See:
57 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/drag 59 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/e lement/:id/drag
58 class DragCommand : public WebElementCommand { 60 class DragCommand : public WebElementCommand {
59 public: 61 public:
60 DragCommand(const std::vector<std::string>& path_segments, 62 DragCommand(const std::vector<std::string>& path_segments,
61 const DictionaryValue* const parameters); 63 const base::DictionaryValue* const parameters);
62 virtual ~DragCommand(); 64 virtual ~DragCommand();
63 65
64 virtual bool Init(Response* const response); 66 virtual bool Init(Response* const response);
65 virtual bool DoesPost(); 67 virtual bool DoesPost();
66 virtual void ExecutePost(Response* const response); 68 virtual void ExecutePost(Response* const response);
67 69
68 private: 70 private:
69 int drag_x_, drag_y_; 71 int drag_x_, drag_y_;
70 72
71 DISALLOW_COPY_AND_ASSIGN(DragCommand); 73 DISALLOW_COPY_AND_ASSIGN(DragCommand);
72 }; 74 };
73 75
74 // Base class for the following API command classes. 76 // Base class for the following API command classes.
75 // - /session/:sessionId/moveto 77 // - /session/:sessionId/moveto
76 // - /session/:sessionId/click 78 // - /session/:sessionId/click
77 // - /session/:sessionId/buttondown 79 // - /session/:sessionId/buttondown
78 // - /session/:sessionId/buttonup 80 // - /session/:sessionId/buttonup
79 // - /session/:sessionId/doubleclick 81 // - /session/:sessionId/doubleclick
80 class AdvancedMouseCommand : public WebDriverCommand { 82 class AdvancedMouseCommand : public WebDriverCommand {
81 public: 83 public:
82 AdvancedMouseCommand(const std::vector<std::string>& path_segments, 84 AdvancedMouseCommand(const std::vector<std::string>& path_segments,
83 const DictionaryValue* const parameters); 85 const base::DictionaryValue* const parameters);
84 virtual ~AdvancedMouseCommand(); 86 virtual ~AdvancedMouseCommand();
85 87
86 virtual bool DoesPost(); 88 virtual bool DoesPost();
87 89
88 private: 90 private:
89 DISALLOW_COPY_AND_ASSIGN(AdvancedMouseCommand); 91 DISALLOW_COPY_AND_ASSIGN(AdvancedMouseCommand);
90 }; 92 };
91 93
92 // Move the mouse by an offset of the specified element. If no element is 94 // Move the mouse by an offset of the specified element. If no element is
93 // specified, the move is relative to the current mouse cursor. If an element is 95 // specified, the move is relative to the current mouse cursor. If an element is
94 // provided but no offset, the mouse will be moved to the center of the element. 96 // provided but no offset, the mouse will be moved to the center of the element.
95 // If the element is not visible, it will be scrolled into view. 97 // If the element is not visible, it will be scrolled into view.
96 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/m oveto 98 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/m oveto
97 class MoveToCommand : public AdvancedMouseCommand { 99 class MoveToCommand : public AdvancedMouseCommand {
98 public: 100 public:
99 MoveToCommand(const std::vector<std::string>& path_segments, 101 MoveToCommand(const std::vector<std::string>& path_segments,
100 const DictionaryValue* const parameters); 102 const base::DictionaryValue* const parameters);
101 virtual ~MoveToCommand(); 103 virtual ~MoveToCommand();
102 104
103 virtual bool Init(Response* const response); 105 virtual bool Init(Response* const response);
104 virtual void ExecutePost(Response* const response); 106 virtual void ExecutePost(Response* const response);
105 107
106 private: 108 private:
107 bool has_element_; 109 bool has_element_;
108 WebElementId element_; 110 WebElementId element_;
109 bool has_offset_; 111 bool has_offset_;
110 int x_offset_; 112 int x_offset_;
111 int y_offset_; 113 int y_offset_;
112 114
113 DISALLOW_COPY_AND_ASSIGN(MoveToCommand); 115 DISALLOW_COPY_AND_ASSIGN(MoveToCommand);
114 }; 116 };
115 117
116 // Click any mouse button (at the coordinates set by the last moveto command). 118 // Click any mouse button (at the coordinates set by the last moveto command).
117 // Note that calling this command after calling buttondown and before calling 119 // Note that calling this command after calling buttondown and before calling
118 // button up (or any out-of-order interactions sequence) will yield undefined 120 // button up (or any out-of-order interactions sequence) will yield undefined
119 // behaviour). 121 // behaviour).
120 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c lick 122 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c lick
121 class ClickCommand : public AdvancedMouseCommand { 123 class ClickCommand : public AdvancedMouseCommand {
122 public: 124 public:
123 ClickCommand(const std::vector<std::string>& path_segments, 125 ClickCommand(const std::vector<std::string>& path_segments,
124 const DictionaryValue* const parameters); 126 const base::DictionaryValue* const parameters);
125 virtual ~ClickCommand(); 127 virtual ~ClickCommand();
126 128
127 virtual bool Init(Response* const response); 129 virtual bool Init(Response* const response);
128 virtual void ExecutePost(Response* const response); 130 virtual void ExecutePost(Response* const response);
129 131
130 private: 132 private:
131 int button_; 133 int button_;
132 134
133 DISALLOW_COPY_AND_ASSIGN(ClickCommand); 135 DISALLOW_COPY_AND_ASSIGN(ClickCommand);
134 }; 136 };
135 137
136 // Click and hold the left mouse button (at the coordinates set by the last 138 // Click and hold the left mouse button (at the coordinates set by the last
137 // moveto command). Note that the next mouse-related command that should follow 139 // moveto command). Note that the next mouse-related command that should follow
138 // is buttondown . Any other mouse command (such as click or another call to 140 // is buttondown . Any other mouse command (such as click or another call to
139 // buttondown) will yield undefined behaviour. 141 // buttondown) will yield undefined behaviour.
140 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/b uttondown 142 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/b uttondown
141 class ButtonDownCommand : public AdvancedMouseCommand { 143 class ButtonDownCommand : public AdvancedMouseCommand {
142 public: 144 public:
143 ButtonDownCommand(const std::vector<std::string>& path_segments, 145 ButtonDownCommand(const std::vector<std::string>& path_segments,
144 const DictionaryValue* const parameters); 146 const base::DictionaryValue* const parameters);
145 virtual ~ButtonDownCommand(); 147 virtual ~ButtonDownCommand();
146 148
147 virtual void ExecutePost(Response* const response); 149 virtual void ExecutePost(Response* const response);
148 150
149 private: 151 private:
150 DISALLOW_COPY_AND_ASSIGN(ButtonDownCommand); 152 DISALLOW_COPY_AND_ASSIGN(ButtonDownCommand);
151 }; 153 };
152 154
153 // Releases the mouse button previously held (where the mouse is currently at). 155 // Releases the mouse button previously held (where the mouse is currently at).
154 // Must be called once for every buttondown command issued. See the note in 156 // Must be called once for every buttondown command issued. See the note in
155 // click and buttondown about implications of out-of-order commands. 157 // click and buttondown about implications of out-of-order commands.
156 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/b uttonup 158 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/b uttonup
157 class ButtonUpCommand : public AdvancedMouseCommand { 159 class ButtonUpCommand : public AdvancedMouseCommand {
158 public: 160 public:
159 ButtonUpCommand(const std::vector<std::string>& path_segments, 161 ButtonUpCommand(const std::vector<std::string>& path_segments,
160 const DictionaryValue* const parameters); 162 const base::DictionaryValue* const parameters);
161 virtual ~ButtonUpCommand(); 163 virtual ~ButtonUpCommand();
162 164
163 virtual void ExecutePost(Response* const response); 165 virtual void ExecutePost(Response* const response);
164 166
165 private: 167 private:
166 DISALLOW_COPY_AND_ASSIGN(ButtonUpCommand); 168 DISALLOW_COPY_AND_ASSIGN(ButtonUpCommand);
167 }; 169 };
168 170
169 // Double-clicks at the current mouse coordinates (set by moveto). 171 // Double-clicks at the current mouse coordinates (set by moveto).
170 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/d oubleclick 172 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/d oubleclick
171 class DoubleClickCommand : public AdvancedMouseCommand { 173 class DoubleClickCommand : public AdvancedMouseCommand {
172 public: 174 public:
173 DoubleClickCommand(const std::vector<std::string>& ps, 175 DoubleClickCommand(const std::vector<std::string>& ps,
174 const DictionaryValue* const parameters); 176 const base::DictionaryValue* const parameters);
175 virtual ~DoubleClickCommand(); 177 virtual ~DoubleClickCommand();
176 178
177 virtual void ExecutePost(Response* const response); 179 virtual void ExecutePost(Response* const response);
178 180
179 private: 181 private:
180 DISALLOW_COPY_AND_ASSIGN(DoubleClickCommand); 182 DISALLOW_COPY_AND_ASSIGN(DoubleClickCommand);
181 }; 183 };
182 184
183 } // namespace webdriver 185 } // namespace webdriver
184 186
185 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_MOUSE_COMMANDS_H_ 187 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_MOUSE_COMMANDS_H_
OLDNEW
« no previous file with comments | « chrome/test/webdriver/commands/execute_async_script_command.h ('k') | chrome/test/webdriver/commands/screenshot_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698