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/commands/webdriver_command.h" | 5 #include "chrome/test/webdriver/commands/webdriver_command.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 return false; | 34 return false; |
35 } | 35 } |
36 | 36 |
37 session_ = SessionManager::GetInstance()->GetSession(session_id); | 37 session_ = SessionManager::GetInstance()->GetSession(session_id); |
38 if (session_ == NULL) { | 38 if (session_ == NULL) { |
39 response->SetError( | 39 response->SetError( |
40 new Error(kSessionNotFound, "Session not found: " + session_id)); | 40 new Error(kSessionNotFound, "Session not found: " + session_id)); |
41 return false; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 LOG(INFO) << "Waiting for the page to stop loading"; | 44 Error* error = session_->BeforeExecuteCommand(); |
45 Error* error = session_->WaitForAllTabsToStopLoading(); | |
46 if (error) { | 45 if (error) { |
47 response->SetError(error); | 46 response->SetError(error); |
48 return false; | 47 return false; |
49 } | 48 } |
50 LOG(INFO) << "Done waiting for the page to stop loading"; | |
51 error = session_->SwitchToTopFrameIfCurrentFrameInvalid(); | |
52 if (error) { | |
53 response->SetError(error); | |
54 return false; | |
55 } | |
56 | |
57 response->SetField("sessionId", Value::CreateStringValue(session_id)); | 49 response->SetField("sessionId", Value::CreateStringValue(session_id)); |
58 return true; | 50 return true; |
59 } | 51 } |
60 | 52 |
61 } // namespace webdriver | 53 } // namespace webdriver |
OLD | NEW |