| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webdriver/webdriver_session.h" | 5 #include "chrome/test/webdriver/webdriver_session.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 this, | 86 this, |
| 87 &Session::InitOnSessionThread, | 87 &Session::InitOnSessionThread, |
| 88 options, | 88 options, |
| 89 &error)); | 89 &error)); |
| 90 if (error) | 90 if (error) |
| 91 Terminate(); | 91 Terminate(); |
| 92 return error; | 92 return error; |
| 93 } | 93 } |
| 94 | 94 |
| 95 Error* Session::BeforeExecuteCommand() { | 95 Error* Session::BeforeExecuteCommand() { |
| 96 Error* error = AfterExecuteCommand(); |
| 97 if (!error) { |
| 98 scoped_ptr<Error> switch_error(SwitchToTopFrameIfCurrentFrameInvalid()); |
| 99 if (switch_error.get()) { |
| 100 std::string text; |
| 101 scoped_ptr<Error> alert_error(GetAlertMessage(&text)); |
| 102 if (alert_error.get()) { |
| 103 // Only return a frame checking error if a modal dialog is not present. |
| 104 // TODO(kkania): This is ugly. Fix. |
| 105 return switch_error.release(); |
| 106 } |
| 107 } |
| 108 } |
| 109 return error; |
| 110 } |
| 111 |
| 112 Error* Session::AfterExecuteCommand() { |
| 96 Error* error = NULL; | 113 Error* error = NULL; |
| 97 if (!options_.load_async) { | 114 if (!options_.load_async) { |
| 98 LOG(INFO) << "Waiting for the page to stop loading"; | 115 LOG(INFO) << "Waiting for the page to stop loading"; |
| 99 error = WaitForAllTabsToStopLoading(); | 116 error = WaitForAllTabsToStopLoading(); |
| 100 LOG(INFO) << "Done waiting for the page to stop loading"; | 117 LOG(INFO) << "Done waiting for the page to stop loading"; |
| 101 } | 118 } |
| 102 if (!error) { | |
| 103 error = SwitchToTopFrameIfCurrentFrameInvalid(); | |
| 104 } | |
| 105 return error; | 119 return error; |
| 106 } | 120 } |
| 107 | 121 |
| 108 void Session::Terminate() { | 122 void Session::Terminate() { |
| 109 RunSessionTask(NewRunnableMethod( | 123 RunSessionTask(NewRunnableMethod( |
| 110 this, | 124 this, |
| 111 &Session::TerminateOnSessionThread)); | 125 &Session::TerminateOnSessionThread)); |
| 112 delete this; | 126 delete this; |
| 113 } | 127 } |
| 114 | 128 |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 Error* Session::GetAppCacheStatus(int* status) { | 1400 Error* Session::GetAppCacheStatus(int* status) { |
| 1387 return ExecuteScriptAndParse( | 1401 return ExecuteScriptAndParse( |
| 1388 current_target_, | 1402 current_target_, |
| 1389 atoms::GET_APPCACHE_STATUS, | 1403 atoms::GET_APPCACHE_STATUS, |
| 1390 "getAppcacheStatus", | 1404 "getAppcacheStatus", |
| 1391 new ListValue(), | 1405 new ListValue(), |
| 1392 CreateDirectValueParser(status)); | 1406 CreateDirectValueParser(status)); |
| 1393 } | 1407 } |
| 1394 | 1408 |
| 1395 } // namespace webdriver | 1409 } // namespace webdriver |
| OLD | NEW |