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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return status; | 225 return status; |
226 return Status(kUnexpectedAlertOpen, "{Alert text : " + alert_text + "}"); | 226 return Status(kUnexpectedAlertOpen, "{Alert text : " + alert_text + "}"); |
227 } | 227 } |
228 | 228 |
229 Status nav_status(kOk); | 229 Status nav_status(kOk); |
230 for (int attempt = 0; attempt < 3; attempt++) { | 230 for (int attempt = 0; attempt < 3; attempt++) { |
231 if (attempt == 2) { | 231 if (attempt == 2) { |
232 // Switch to main frame and retry command if subframe no longer exists. | 232 // Switch to main frame and retry command if subframe no longer exists. |
233 session->SwitchToTopFrame(); | 233 session->SwitchToTopFrame(); |
234 } | 234 } |
235 | |
236 nav_status = web_view->WaitForPendingNavigations( | 235 nav_status = web_view->WaitForPendingNavigations( |
237 session->GetCurrentFrameId(), | 236 session->GetCurrentFrameId(), |
238 Timeout(session->page_load_timeout, &timeout), true); | 237 Timeout(session->page_load_timeout, &timeout), true); |
239 if (nav_status.IsError()) | 238 if (nav_status.IsError()) |
240 return nav_status; | 239 return nav_status; |
241 | 240 |
242 status = command.Run(session, web_view, params, value, &timeout); | 241 status = command.Run(session, web_view, params, value, &timeout); |
243 if (status.code() == kNoSuchExecutionContext || status.code() == kTimeout) { | 242 if (status.code() == kNoSuchExecutionContext || status.code() == kTimeout) { |
244 // If the command timed out, let WaitForPendingNavigations cancel | 243 // If the command timed out, let WaitForPendingNavigations cancel |
245 // the navigation if there is one. | 244 // the navigation if there is one. |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 return status; | 1062 return status; |
1064 } | 1063 } |
1065 | 1064 |
1066 Status ExecuteTakeHeapSnapshot(Session* session, | 1065 Status ExecuteTakeHeapSnapshot(Session* session, |
1067 WebView* web_view, | 1066 WebView* web_view, |
1068 const base::DictionaryValue& params, | 1067 const base::DictionaryValue& params, |
1069 std::unique_ptr<base::Value>* value, | 1068 std::unique_ptr<base::Value>* value, |
1070 Timeout* timeout) { | 1069 Timeout* timeout) { |
1071 return web_view->TakeHeapSnapshot(value); | 1070 return web_view->TakeHeapSnapshot(value); |
1072 } | 1071 } |
OLD | NEW |