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 #ifndef CHROME_TEST_CHROMEDRIVER_SESSION_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_SESSION_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_SESSION_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_SESSION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/test/chromedriver/basic_types.h" | 16 #include "chrome/test/chromedriver/basic_types.h" |
17 #include "chrome/test/chromedriver/chrome/device_metrics.h" | 17 #include "chrome/test/chromedriver/chrome/device_metrics.h" |
18 #include "chrome/test/chromedriver/chrome/geoposition.h" | 18 #include "chrome/test/chromedriver/chrome/geoposition.h" |
19 #include "chrome/test/chromedriver/command_listener.h" | |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class DictionaryValue; | 22 class DictionaryValue; |
22 } | 23 } |
23 | 24 |
24 class Chrome; | 25 class Chrome; |
25 class Status; | 26 class Status; |
26 class WebDriverLog; | 27 class WebDriverLog; |
27 class WebView; | 28 class WebView; |
28 | 29 |
(...skipping 13 matching lines...) Expand all Loading... | |
42 explicit Session(const std::string& id); | 43 explicit Session(const std::string& id); |
43 Session(const std::string& id, scoped_ptr<Chrome> chrome); | 44 Session(const std::string& id, scoped_ptr<Chrome> chrome); |
44 ~Session(); | 45 ~Session(); |
45 | 46 |
46 Status GetTargetWindow(WebView** web_view); | 47 Status GetTargetWindow(WebView** web_view); |
47 | 48 |
48 void SwitchToTopFrame(); | 49 void SwitchToTopFrame(); |
49 void SwitchToParentFrame(); | 50 void SwitchToParentFrame(); |
50 void SwitchToSubFrame(const std::string& frame_id, | 51 void SwitchToSubFrame(const std::string& frame_id, |
51 const std::string& chromedriver_frame_id); | 52 const std::string& chromedriver_frame_id); |
53 void AddListener(CommandListener* listener); | |
stgao
2014/07/01 19:02:27
Seems unused now.
Could be removed.
johnmoore
2014/07/02 22:17:44
Done.
| |
52 std::string GetCurrentFrameId() const; | 54 std::string GetCurrentFrameId() const; |
53 std::vector<WebDriverLog*> GetAllLogs() const; | 55 std::vector<WebDriverLog*> GetAllLogs() const; |
54 std::string GetFirstBrowserError() const; | 56 std::string GetFirstBrowserError() const; |
55 | 57 |
56 const std::string id; | 58 const std::string id; |
57 bool quit; | 59 bool quit; |
58 bool detach; | 60 bool detach; |
59 bool force_devtools_screenshot; | 61 bool force_devtools_screenshot; |
60 scoped_ptr<Chrome> chrome; | 62 scoped_ptr<Chrome> chrome; |
61 std::string window; | 63 std::string window; |
62 int sticky_modifiers; | 64 int sticky_modifiers; |
63 // List of |FrameInfo|s for each frame to the current target frame from the | 65 // List of |FrameInfo|s for each frame to the current target frame from the |
64 // first frame element in the root document. If target frame is window.top, | 66 // first frame element in the root document. If target frame is window.top, |
65 // this list will be empty. | 67 // this list will be empty. |
66 std::list<FrameInfo> frames; | 68 std::list<FrameInfo> frames; |
67 WebPoint mouse_position; | 69 WebPoint mouse_position; |
68 base::TimeDelta implicit_wait; | 70 base::TimeDelta implicit_wait; |
69 base::TimeDelta page_load_timeout; | 71 base::TimeDelta page_load_timeout; |
70 base::TimeDelta script_timeout; | 72 base::TimeDelta script_timeout; |
71 scoped_ptr<std::string> prompt_text; | 73 scoped_ptr<std::string> prompt_text; |
72 scoped_ptr<Geoposition> overridden_geoposition; | 74 scoped_ptr<Geoposition> overridden_geoposition; |
73 scoped_ptr<DeviceMetrics> overridden_device_metrics; | 75 scoped_ptr<DeviceMetrics> overridden_device_metrics; |
74 // Logs that populate from DevTools events. | 76 // Logs that populate from DevTools events. |
75 ScopedVector<WebDriverLog> devtools_logs; | 77 ScopedVector<WebDriverLog> devtools_logs; |
76 scoped_ptr<WebDriverLog> driver_log; | 78 scoped_ptr<WebDriverLog> driver_log; |
77 base::ScopedTempDir temp_dir; | 79 base::ScopedTempDir temp_dir; |
78 scoped_ptr<base::DictionaryValue> capabilities; | 80 scoped_ptr<base::DictionaryValue> capabilities; |
79 bool auto_reporting_enabled; | 81 bool auto_reporting_enabled; |
82 // |command_listeners| should be declared after |chrome|. When the |Session| | |
83 // is destroyed, |command_listeners| should be freed first, since some | |
84 // |CommandListener|s might be |CommandListenerProxy|s that forward to | |
85 // |DevToolsEventListener|s owned by |chrome|. | |
86 ScopedVector<CommandListener> command_listeners; | |
80 }; | 87 }; |
81 | 88 |
82 Session* GetThreadLocalSession(); | 89 Session* GetThreadLocalSession(); |
83 | 90 |
84 void SetThreadLocalSession(scoped_ptr<Session> session); | 91 void SetThreadLocalSession(scoped_ptr<Session> session); |
85 | 92 |
86 #endif // CHROME_TEST_CHROMEDRIVER_SESSION_H_ | 93 #endif // CHROME_TEST_CHROMEDRIVER_SESSION_H_ |
OLD | NEW |