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

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

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

Powered by Google App Engine
This is Rietveld 408576698