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 <list> | 7 #include <list> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/test/chromedriver/chrome/chrome.h" | 10 #include "chrome/test/chromedriver/chrome/chrome.h" |
11 #include "chrome/test/chromedriver/chrome/status.h" | 11 #include "chrome/test/chromedriver/chrome/status.h" |
12 #include "chrome/test/chromedriver/chrome/version.h" | 12 #include "chrome/test/chromedriver/chrome/version.h" |
13 #include "chrome/test/chromedriver/chrome/web_view.h" | 13 #include "chrome/test/chromedriver/chrome/web_view.h" |
14 #include "chrome/test/chromedriver/logging.h" | 14 #include "chrome/test/chromedriver/logging.h" |
15 | 15 |
16 FrameInfo::FrameInfo(const std::string& parent_frame_id, | 16 FrameInfo::FrameInfo(const std::string& parent_frame_id, |
17 const std::string& frame_id, | 17 const std::string& frame_id, |
18 const std::string& chromedriver_frame_id) | 18 const std::string& chromedriver_frame_id) |
19 : parent_frame_id(parent_frame_id), | 19 : parent_frame_id(parent_frame_id), |
20 frame_id(frame_id), | 20 frame_id(frame_id), |
21 chromedriver_frame_id(chromedriver_frame_id) {} | 21 chromedriver_frame_id(chromedriver_frame_id) {} |
22 | 22 |
23 const int Session::kDefaultPageLoadTimeoutMs = 5 * 60 * 1000; | 23 const int Session::kDefaultPageLoadTimeoutMs = 5 * 60 * 1000; |
24 | 24 |
25 Session::Session(const std::string& id) | 25 Session::Session(const std::string& id) |
26 : id(id), | 26 : id(id), |
27 thread(("SessionThread_" + id).c_str()), | 27 quit(false), |
28 detach(false), | 28 detach(false), |
29 sticky_modifiers(0), | 29 sticky_modifiers(0), |
30 mouse_position(0, 0), | 30 mouse_position(0, 0), |
31 implicit_wait(0), | 31 implicit_wait(0), |
32 page_load_timeout(kDefaultPageLoadTimeoutMs), | 32 page_load_timeout(kDefaultPageLoadTimeoutMs), |
33 script_timeout(0) { | 33 script_timeout(0) { |
34 } | 34 } |
35 | 35 |
36 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) | 36 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) |
37 : id(id), | 37 : id(id), |
38 thread(("SessionThread_" + id).c_str()), | 38 quit(false), |
39 detach(false), | 39 detach(false), |
40 chrome(chrome.Pass()), | 40 chrome(chrome.Pass()), |
41 sticky_modifiers(0), | 41 sticky_modifiers(0), |
42 mouse_position(0, 0), | 42 mouse_position(0, 0), |
43 implicit_wait(0), | 43 implicit_wait(0), |
44 page_load_timeout(kDefaultPageLoadTimeoutMs), | 44 page_load_timeout(kDefaultPageLoadTimeoutMs), |
45 script_timeout(0), | 45 script_timeout(0), |
46 capabilities(CreateCapabilities()) { | 46 capabilities(CreateCapabilities()) { |
47 } | 47 } |
48 | 48 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 caps->SetBoolean("locationContextEnabled", true); | 89 caps->SetBoolean("locationContextEnabled", true); |
90 caps->SetBoolean("applicationCacheEnabled", false); | 90 caps->SetBoolean("applicationCacheEnabled", false); |
91 caps->SetBoolean("browserConnectionEnabled", false); | 91 caps->SetBoolean("browserConnectionEnabled", false); |
92 caps->SetBoolean("cssSelectorsEnabled", true); | 92 caps->SetBoolean("cssSelectorsEnabled", true); |
93 caps->SetBoolean("webStorageEnabled", true); | 93 caps->SetBoolean("webStorageEnabled", true); |
94 caps->SetBoolean("rotatable", false); | 94 caps->SetBoolean("rotatable", false); |
95 caps->SetBoolean("acceptSslCerts", true); | 95 caps->SetBoolean("acceptSslCerts", true); |
96 caps->SetBoolean("nativeEvents", true); | 96 caps->SetBoolean("nativeEvents", true); |
97 return caps.Pass(); | 97 return caps.Pass(); |
98 } | 98 } |
99 | |
100 SessionAccessorImpl::SessionAccessorImpl(scoped_ptr<Session> session) | |
101 : session_(session.Pass()) {} | |
102 | |
103 Session* SessionAccessorImpl::Access(scoped_ptr<base::AutoLock>* lock) { | |
104 lock->reset(new base::AutoLock(session_lock_)); | |
105 return session_.get(); | |
106 } | |
107 | |
108 void SessionAccessorImpl::DeleteSession() { | |
109 session_.reset(); | |
110 } | |
111 | |
112 SessionAccessorImpl::~SessionAccessorImpl() {} | |
OLD | NEW |