| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromedriver/window_commands.h" | 5 #include "chrome/test/chromedriver/window_commands.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 if (has_element) { | 335 if (has_element) { |
| 336 Status status = ScrollElementIntoView( | 336 Status status = ScrollElementIntoView( |
| 337 session, web_view, element_id, &location); | 337 session, web_view, element_id, &location); |
| 338 if (status.IsError()) | 338 if (status.IsError()) |
| 339 return status; | 339 return status; |
| 340 } else { | 340 } else { |
| 341 location = session->mouse_position; | 341 location = session->mouse_position; |
| 342 } | 342 } |
| 343 | 343 |
| 344 if (has_offset) { | 344 if (has_offset) { |
| 345 location.offset(x_offset, y_offset); | 345 location.Offset(x_offset, y_offset); |
| 346 } else { | 346 } else { |
| 347 WebSize size; | 347 WebSize size; |
| 348 Status status = GetElementSize(session, web_view, element_id, &size); | 348 Status status = GetElementSize(session, web_view, element_id, &size); |
| 349 if (status.IsError()) | 349 if (status.IsError()) |
| 350 return status; | 350 return status; |
| 351 location.offset(size.width / 2, size.height / 2); | 351 location.Offset(size.width / 2, size.height / 2); |
| 352 } | 352 } |
| 353 | 353 |
| 354 std::list<MouseEvent> events; | 354 std::list<MouseEvent> events; |
| 355 events.push_back( | 355 events.push_back( |
| 356 MouseEvent(kMovedMouseEventType, kNoneMouseButton, | 356 MouseEvent(kMovedMouseEventType, kNoneMouseButton, |
| 357 location.x, location.y, 0)); | 357 location.x, location.y, 0)); |
| 358 Status status = web_view->DispatchMouseEvents(events); | 358 Status status = web_view->DispatchMouseEvents(events); |
| 359 if (status.IsOk()) | 359 if (status.IsOk()) |
| 360 session->mouse_position = location; | 360 session->mouse_position = location; |
| 361 return status; | 361 return status; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 for (std::list<Cookie>::const_iterator it = cookies.begin(); | 649 for (std::list<Cookie>::const_iterator it = cookies.begin(); |
| 650 it != cookies.end(); ++it) { | 650 it != cookies.end(); ++it) { |
| 651 status = web_view->DeleteCookie(it->name, url); | 651 status = web_view->DeleteCookie(it->name, url); |
| 652 if (status.IsError()) | 652 if (status.IsError()) |
| 653 return status; | 653 return status; |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 | 656 |
| 657 return Status(kOk); | 657 return Status(kOk); |
| 658 } | 658 } |
| OLD | NEW |