| 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->ConnectIfNecessary(); |
| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 WebView* web_view, | 486 WebView* web_view, |
| 483 const base::DictionaryValue& params, | 487 const base::DictionaryValue& params, |
| 484 scoped_ptr<base::Value>* value) { | 488 scoped_ptr<base::Value>* value) { |
| 485 std::string screenshot; | 489 std::string screenshot; |
| 486 Status status = web_view->CaptureScreenshot(&screenshot); | 490 Status status = web_view->CaptureScreenshot(&screenshot); |
| 487 if (status.IsError()) | 491 if (status.IsError()) |
| 488 return status; | 492 return status; |
| 489 value->reset(new base::StringValue(screenshot)); | 493 value->reset(new base::StringValue(screenshot)); |
| 490 return Status(kOk); | 494 return Status(kOk); |
| 491 } | 495 } |
| OLD | NEW |