| 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 error = SwitchToTopFrameIfCurrentFrameInvalid(); |
| 99 } |
| 100 return error; |
| 101 } |
| 102 |
| 103 Error* Session::AfterExecuteCommand() { |
| 96 Error* error = NULL; | 104 Error* error = NULL; |
| 97 if (!options_.load_async) { | 105 if (!options_.load_async) { |
| 98 LOG(INFO) << "Waiting for the page to stop loading"; | 106 LOG(INFO) << "Waiting for the page to stop loading"; |
| 99 error = WaitForAllTabsToStopLoading(); | 107 error = WaitForAllTabsToStopLoading(); |
| 100 LOG(INFO) << "Done waiting for the page to stop loading"; | 108 LOG(INFO) << "Done waiting for the page to stop loading"; |
| 101 } | 109 } |
| 102 if (!error) { | |
| 103 error = SwitchToTopFrameIfCurrentFrameInvalid(); | |
| 104 } | |
| 105 return error; | 110 return error; |
| 106 } | 111 } |
| 107 | 112 |
| 108 void Session::Terminate() { | 113 void Session::Terminate() { |
| 109 RunSessionTask(NewRunnableMethod( | 114 RunSessionTask(NewRunnableMethod( |
| 110 this, | 115 this, |
| 111 &Session::TerminateOnSessionThread)); | 116 &Session::TerminateOnSessionThread)); |
| 112 delete this; | 117 delete this; |
| 113 } | 118 } |
| 114 | 119 |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 Error* Session::GetAppCacheStatus(int* status) { | 1391 Error* Session::GetAppCacheStatus(int* status) { |
| 1387 return ExecuteScriptAndParse( | 1392 return ExecuteScriptAndParse( |
| 1388 current_target_, | 1393 current_target_, |
| 1389 atoms::GET_APPCACHE_STATUS, | 1394 atoms::GET_APPCACHE_STATUS, |
| 1390 "getAppcacheStatus", | 1395 "getAppcacheStatus", |
| 1391 new ListValue(), | 1396 new ListValue(), |
| 1392 CreateDirectValueParser(status)); | 1397 CreateDirectValueParser(status)); |
| 1393 } | 1398 } |
| 1394 | 1399 |
| 1395 } // namespace webdriver | 1400 } // namespace webdriver |
| OLD | NEW |