OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/session.h" | 5 #include "chrome/test/chromedriver/session.h" |
6 | 6 |
7 #include "chrome/test/chromedriver/chrome.h" | 7 #include "chrome/test/chromedriver/chrome.h" |
| 8 #include "chrome/test/chromedriver/status.h" |
8 | 9 |
9 Session::Session(const std::string& id) | 10 Session::Session(const std::string& id) |
10 : id(id), mouse_position(0, 0), implicit_wait(0), page_load_timeout(0), | 11 : id(id), mouse_position(0, 0), implicit_wait(0), page_load_timeout(0), |
11 script_timeout(0) {} | 12 script_timeout(0) {} |
12 | 13 |
13 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) | 14 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) |
14 : id(id), chrome(chrome.Pass()), mouse_position(0, 0), implicit_wait(0), | 15 : id(id), chrome(chrome.Pass()), mouse_position(0, 0), implicit_wait(0), |
15 page_load_timeout(0), script_timeout(0) {} | 16 page_load_timeout(0), script_timeout(0) {} |
16 | 17 |
17 Session::~Session() {} | 18 Session::~Session() {} |
18 | 19 |
| 20 Status Session::WaitForPendingNavigations() { |
| 21 if (!chrome) |
| 22 return Status(kOk); |
| 23 std::string full_frame_id(frame); |
| 24 if (full_frame_id == "") { |
| 25 Status status = chrome->GetMainFrame(&full_frame_id); |
| 26 if (status.IsError()) |
| 27 return status; |
| 28 } |
| 29 return chrome->WaitForPendingNavigations(full_frame_id); |
| 30 } |
| 31 |
19 SessionAccessorImpl::SessionAccessorImpl(scoped_ptr<Session> session) | 32 SessionAccessorImpl::SessionAccessorImpl(scoped_ptr<Session> session) |
20 : session_(session.Pass()) {} | 33 : session_(session.Pass()) {} |
21 | 34 |
22 Session* SessionAccessorImpl::Access(scoped_ptr<base::AutoLock>* lock) { | 35 Session* SessionAccessorImpl::Access(scoped_ptr<base::AutoLock>* lock) { |
23 lock->reset(new base::AutoLock(session_lock_)); | 36 lock->reset(new base::AutoLock(session_lock_)); |
24 return session_.get(); | 37 return session_.get(); |
25 } | 38 } |
26 | 39 |
27 SessionAccessorImpl::~SessionAccessorImpl() {} | 40 SessionAccessorImpl::~SessionAccessorImpl() {} |
OLD | NEW |