| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 if (status.IsError()) | 45 if (status.IsError()) |
| 46 return status; | 46 return status; |
| 47 if (is_dialog_open) | 47 if (is_dialog_open) |
| 48 return Status(kUnexpectedAlertOpen); | 48 return Status(kUnexpectedAlertOpen); |
| 49 | 49 |
| 50 WebView* web_view = NULL; | 50 WebView* web_view = NULL; |
| 51 status = session->GetTargetWindow(&web_view); | 51 status = session->GetTargetWindow(&web_view); |
| 52 if (status.IsError()) | 52 if (status.IsError()) |
| 53 return status; | 53 return status; |
| 54 | 54 |
| 55 status = web_view->EnsureAlive(); |
| 56 if (status.IsError()) |
| 57 return status; |
| 58 |
| 55 Status nav_status = web_view->WaitForPendingNavigations(session->frame); | 59 Status nav_status = web_view->WaitForPendingNavigations(session->frame); |
| 56 if (nav_status.IsError()) | 60 if (nav_status.IsError()) |
| 57 return nav_status; | 61 return nav_status; |
| 58 status = command.Run(session, web_view, params, value); | 62 status = command.Run(session, web_view, params, value); |
| 59 // Switch to main frame and retry command if subframe no longer exists. | 63 // Switch to main frame and retry command if subframe no longer exists. |
| 60 if (status.code() == kNoSuchFrame) { | 64 if (status.code() == kNoSuchFrame) { |
| 61 session->frame = ""; | 65 session->frame = ""; |
| 62 nav_status = web_view->WaitForPendingNavigations(session->frame); | 66 nav_status = web_view->WaitForPendingNavigations(session->frame); |
| 63 if (nav_status.IsError()) | 67 if (nav_status.IsError()) |
| 64 return nav_status; | 68 return nav_status; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 return status; | 338 return status; |
| 335 std::list<MouseEvent> events; | 339 std::list<MouseEvent> events; |
| 336 events.push_back( | 340 events.push_back( |
| 337 MouseEvent(kPressedMouseEventType, button, | 341 MouseEvent(kPressedMouseEventType, button, |
| 338 session->mouse_position.x, session->mouse_position.y, 2)); | 342 session->mouse_position.x, session->mouse_position.y, 2)); |
| 339 events.push_back( | 343 events.push_back( |
| 340 MouseEvent(kReleasedMouseEventType, button, | 344 MouseEvent(kReleasedMouseEventType, button, |
| 341 session->mouse_position.x, session->mouse_position.y, 2)); | 345 session->mouse_position.x, session->mouse_position.y, 2)); |
| 342 return web_view->DispatchMouseEvents(events); | 346 return web_view->DispatchMouseEvents(events); |
| 343 } | 347 } |
| OLD | NEW |