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

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

Issue 7055004: File upload API in chromedriver (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed according to the code review. Created 9 years, 6 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 #include "chrome/test/webdriver/commands/mouse_commands.h" 5 #include "chrome/test/webdriver/commands/mouse_commands.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/common/automation_constants.h" 8 #include "chrome/common/automation_constants.h"
9 #include "chrome/test/webdriver/commands/response.h" 9 #include "chrome/test/webdriver/commands/response.h"
10 #include "chrome/test/webdriver/session.h" 10 #include "chrome/test/webdriver/session.h"
(...skipping 17 matching lines...) Expand all
28 const DictionaryValue* const parameters) 28 const DictionaryValue* const parameters)
29 : WebElementCommand(path_segments, parameters) {} 29 : WebElementCommand(path_segments, parameters) {}
30 30
31 ElementMouseCommand::~ElementMouseCommand() {} 31 ElementMouseCommand::~ElementMouseCommand() {}
32 32
33 bool ElementMouseCommand::DoesPost() { 33 bool ElementMouseCommand::DoesPost() {
34 return true; 34 return true;
35 } 35 }
36 36
37 void ElementMouseCommand::ExecutePost(Response* response) { 37 void ElementMouseCommand::ExecutePost(Response* response) {
38 Error* error = session_->CheckElementPreconditionsForClicking(element); 38 gfx::Point location;
39 Error* error = session_->GetClickableLocation(element, &location);
39 if (error) { 40 if (error) {
40 response->SetError(error); 41 response->SetError(error);
41 return; 42 return;
42 } 43 }
43 44
44 gfx::Point location;
45 error = session_->GetElementLocationInView(element, &location);
46 if (error) {
47 response->SetError(error);
48 return;
49 }
50
51 gfx::Size size;
52 error = session_->GetElementSize(session_->current_target(), element, &size);
53 if (error) {
54 response->SetError(error);
55 return;
56 }
57
58 location.Offset(size.width() / 2, size.height() / 2);
59 error = Action(location); 45 error = Action(location);
60 if (error) { 46 if (error) {
61 response->SetError(error); 47 response->SetError(error);
62 return; 48 return;
63 } 49 }
64 } 50 }
65 51
66 MoveAndClickCommand::MoveAndClickCommand( 52 MoveAndClickCommand::MoveAndClickCommand(
67 const std::vector<std::string>& path_segments, 53 const std::vector<std::string>& path_segments,
68 const DictionaryValue* const parameters) 54 const DictionaryValue* const parameters)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 256
271 void DoubleClickCommand::ExecutePost(Response* const response) { 257 void DoubleClickCommand::ExecutePost(Response* const response) {
272 Error* error = session_->MouseDoubleClick(); 258 Error* error = session_->MouseDoubleClick();
273 if (error) { 259 if (error) {
274 response->SetError(error); 260 response->SetError(error);
275 return; 261 return;
276 } 262 }
277 } 263 }
278 264
279 } // namespace webdriver 265 } // namespace webdriver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698