| 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/alert_commands.h" | 5 #include "chrome/test/chromedriver/alert_commands.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/test/chromedriver/chrome/chrome.h" | 9 #include "chrome/test/chromedriver/chrome/chrome.h" |
| 10 #include "chrome/test/chromedriver/chrome/devtools_client.h" | 10 #include "chrome/test/chromedriver/chrome/devtools_client.h" |
| 11 #include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h" | 11 #include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h" |
| 12 #include "chrome/test/chromedriver/chrome/status.h" | 12 #include "chrome/test/chromedriver/chrome/status.h" |
| 13 #include "chrome/test/chromedriver/chrome/web_view.h" | 13 #include "chrome/test/chromedriver/chrome/web_view.h" |
| 14 #include "chrome/test/chromedriver/session.h" | 14 #include "chrome/test/chromedriver/session.h" |
| 15 #include "chrome/test/chromedriver/util.h" |
| 15 | 16 |
| 16 Status ExecuteAlertCommand( | 17 Status ExecuteAlertCommand( |
| 17 const AlertCommand& alert_command, | 18 const AlertCommand& alert_command, |
| 18 Session* session, | 19 Session* session, |
| 19 const base::DictionaryValue& params, | 20 const base::DictionaryValue& params, |
| 20 scoped_ptr<base::Value>* value) { | 21 scoped_ptr<base::Value>* value) { |
| 21 WebView* web_view = NULL; | 22 WebView* web_view = NULL; |
| 22 Status status = session->GetTargetWindow(&web_view); | 23 Status status = session->GetTargetWindow(&web_view); |
| 23 if (status.IsError()) | 24 if (status.IsError()) |
| 24 return status; | 25 return status; |
| 25 | 26 |
| 26 status = web_view->ConnectIfNecessary(); | 27 status = web_view->ConnectIfNecessary(); |
| 27 if (status.IsError()) | 28 if (status.IsError()) |
| 28 return status; | 29 return status; |
| 29 | 30 |
| 30 status = web_view->HandleReceivedEvents(); | 31 status = web_view->HandleReceivedEvents(); |
| 31 if (status.IsError()) | 32 if (status.IsError()) |
| 32 return status; | 33 return status; |
| 33 | 34 |
| 34 status = web_view->WaitForPendingNavigations( | 35 status = web_view->WaitForPendingNavigations( |
| 35 session->GetCurrentFrameId(), session->page_load_timeout, true); | 36 session->GetCurrentFrameId(), Timeout(session->page_load_timeout), true); |
| 36 if (status.IsError() && status.code() != kUnexpectedAlertOpen) | 37 if (status.IsError() && status.code() != kUnexpectedAlertOpen) |
| 37 return status; | 38 return status; |
| 38 | 39 |
| 39 return alert_command.Run(session, web_view, params, value); | 40 return alert_command.Run(session, web_view, params, value); |
| 40 } | 41 } |
| 41 | 42 |
| 42 Status ExecuteGetAlert( | 43 Status ExecuteGetAlert( |
| 43 Session* session, | 44 Session* session, |
| 44 WebView* web_view, | 45 WebView* web_view, |
| 45 const base::DictionaryValue& params, | 46 const base::DictionaryValue& params, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 Status ExecuteDismissAlert( | 94 Status ExecuteDismissAlert( |
| 94 Session* session, | 95 Session* session, |
| 95 WebView* web_view, | 96 WebView* web_view, |
| 96 const base::DictionaryValue& params, | 97 const base::DictionaryValue& params, |
| 97 scoped_ptr<base::Value>* value) { | 98 scoped_ptr<base::Value>* value) { |
| 98 Status status = web_view->GetJavaScriptDialogManager() | 99 Status status = web_view->GetJavaScriptDialogManager() |
| 99 ->HandleDialog(false, session->prompt_text.get()); | 100 ->HandleDialog(false, session->prompt_text.get()); |
| 100 session->prompt_text.reset(); | 101 session->prompt_text.reset(); |
| 101 return status; | 102 return status; |
| 102 } | 103 } |
| OLD | NEW |