OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CHROME_WEB_VIEW_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_WEB_VIEW_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_WEB_VIEW_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_WEB_VIEW_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 class FilePath; | 16 class FilePath; |
17 class ListValue; | 17 class ListValue; |
18 class TimeDelta; | 18 class TimeDelta; |
19 class Value; | 19 class Value; |
20 } | 20 } |
21 | 21 |
22 class DevToolsClient; | 22 class DevToolsClient; |
23 struct Geoposition; | 23 struct Geoposition; |
24 class JavaScriptDialogManager; | 24 class JavaScriptDialogManager; |
25 struct KeyEvent; | 25 struct KeyEvent; |
26 struct MouseEvent; | 26 struct MouseEvent; |
27 struct NetworkConditions; | 27 struct NetworkConditions; |
| 28 class Status; |
| 29 class Timeout; |
28 struct TouchEvent; | 30 struct TouchEvent; |
29 class Status; | |
30 | 31 |
31 class WebView { | 32 class WebView { |
32 public: | 33 public: |
33 virtual ~WebView() {} | 34 virtual ~WebView() {} |
34 | 35 |
35 // Return the id for this WebView. | 36 // Return the id for this WebView. |
36 virtual std::string GetId() = 0; | 37 virtual std::string GetId() = 0; |
37 | 38 |
38 // Return true if the web view was crashed. | 39 // Return true if the web view was crashed. |
39 virtual bool WasCrashed() = 0; | 40 virtual bool WasCrashed() = 0; |
40 | 41 |
41 // Make DevToolsCient connect to DevTools if it is disconnected. | 42 // Make DevToolsCient connect to DevTools if it is disconnected. |
42 virtual Status ConnectIfNecessary() = 0; | 43 virtual Status ConnectIfNecessary() = 0; |
43 | 44 |
44 // Handles events that have been received but not yet handled. | 45 // Handles events that have been received but not yet handled. |
45 virtual Status HandleReceivedEvents() = 0; | 46 virtual Status HandleReceivedEvents() = 0; |
46 | 47 |
47 // Get the current URL of the main frame. | 48 // Get the current URL of the main frame. |
48 virtual Status GetUrl(std::string* url) = 0; | 49 virtual Status GetUrl(std::string* url) = 0; |
49 | 50 |
50 // Load a given URL in the main frame. | 51 // Load a given URL in the main frame. |
51 virtual Status Load(const std::string& url) = 0; | 52 virtual Status Load(const std::string& url, const Timeout* timeout) = 0; |
52 | 53 |
53 // Reload the current page. | 54 // Reload the current page. |
54 virtual Status Reload() = 0; | 55 virtual Status Reload() = 0; |
55 | 56 |
56 // Navigate |delta| steps forward in the browser history. A negative value | 57 // Navigate |delta| steps forward in the browser history. A negative value |
57 // will navigate back in the history. If the delta exceeds the number of items | 58 // will navigate back in the history. If the delta exceeds the number of items |
58 // in the browser history, stay on the current page. | 59 // in the browser history, stay on the current page. |
59 virtual Status TraverseHistory(int delta) = 0; | 60 virtual Status TraverseHistory(int delta) = 0; |
60 | 61 |
61 // Evaluates a JavaScript expression in a specified frame and returns | 62 // Evaluates a JavaScript expression in a specified frame and returns |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const std::string& url) = 0; | 129 const std::string& url) = 0; |
129 | 130 |
130 // Waits until all pending navigations have completed in the given frame. | 131 // Waits until all pending navigations have completed in the given frame. |
131 // If |frame_id| is "", waits for navigations on the main frame. | 132 // If |frame_id| is "", waits for navigations on the main frame. |
132 // If a modal dialog appears while waiting, kUnexpectedAlertOpen will be | 133 // If a modal dialog appears while waiting, kUnexpectedAlertOpen will be |
133 // returned. | 134 // returned. |
134 // If timeout is exceeded, will return a timeout status. | 135 // If timeout is exceeded, will return a timeout status. |
135 // If |stop_load_on_timeout| is true, will attempt to stop the page load on | 136 // If |stop_load_on_timeout| is true, will attempt to stop the page load on |
136 // timeout before returning the timeout status. | 137 // timeout before returning the timeout status. |
137 virtual Status WaitForPendingNavigations(const std::string& frame_id, | 138 virtual Status WaitForPendingNavigations(const std::string& frame_id, |
138 const base::TimeDelta& timeout, | 139 const Timeout& timeout, |
139 bool stop_load_on_timeout) = 0; | 140 bool stop_load_on_timeout) = 0; |
140 | 141 |
141 // Returns whether the frame is pending navigation. | 142 // Returns whether the frame is pending navigation. |
142 virtual Status IsPendingNavigation( | 143 virtual Status IsPendingNavigation(const std::string& frame_id, |
143 const std::string& frame_id, bool* is_pending) = 0; | 144 const Timeout* timeout, |
| 145 bool* is_pending) = 0; |
144 | 146 |
145 // Returns the JavaScriptDialogManager. Never null. | 147 // Returns the JavaScriptDialogManager. Never null. |
146 virtual JavaScriptDialogManager* GetJavaScriptDialogManager() = 0; | 148 virtual JavaScriptDialogManager* GetJavaScriptDialogManager() = 0; |
147 | 149 |
148 // Overrides normal geolocation with a given geoposition. | 150 // Overrides normal geolocation with a given geoposition. |
149 virtual Status OverrideGeolocation(const Geoposition& geoposition) = 0; | 151 virtual Status OverrideGeolocation(const Geoposition& geoposition) = 0; |
150 | 152 |
151 // Overrides normal network conditions with given conditions. | 153 // Overrides normal network conditions with given conditions. |
152 virtual Status OverrideNetworkConditions( | 154 virtual Status OverrideNetworkConditions( |
153 const NetworkConditions& network_conditions) = 0; | 155 const NetworkConditions& network_conditions) = 0; |
(...skipping 29 matching lines...) Expand all Loading... |
183 | 185 |
184 virtual Status SynthesizeScrollGesture(int x, | 186 virtual Status SynthesizeScrollGesture(int x, |
185 int y, | 187 int y, |
186 int xoffset, | 188 int xoffset, |
187 int yoffset) = 0; | 189 int yoffset) = 0; |
188 | 190 |
189 virtual Status SynthesizePinchGesture(int x, int y, double scale_factor) = 0; | 191 virtual Status SynthesizePinchGesture(int x, int y, double scale_factor) = 0; |
190 }; | 192 }; |
191 | 193 |
192 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_WEB_VIEW_H_ | 194 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_WEB_VIEW_H_ |
OLD | NEW |