OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/web/public/web_state/web_state.h" | 5 #import <UIKit/UIKit.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "base/ios/block_types.h" |
| 10 #include "base/values.h" |
| 11 |
| 12 #import "ios/web/public/web_state/web_state.h" |
| 13 |
9 namespace web { | 14 namespace web { |
10 namespace test { | 15 namespace test { |
11 | 16 |
| 17 // Synchronously returns the result of executed JavaScript. |
| 18 std::unique_ptr<base::Value> ExecuteJavaScript(web::WebState* web_state, |
| 19 const std::string& script); |
| 20 |
| 21 // Returns the CGRect, in the coordinate system of web_state's view, that |
| 22 // encloses the element with |element_id| in |web_state|'s webview. |
| 23 // There is no guarantee that the CGRect returned is inside the current window; |
| 24 // callers should check and act accordingly (scrolling the webview, perhaps). |
| 25 // Returns CGRectNull if no element could be found. |
| 26 CGRect GetBoundingRectOfElementWithId(web::WebState* web_state, |
| 27 const std::string& element_id); |
| 28 |
12 // Returns whether the element with |element_id| in the passed |web_state| has | 29 // Returns whether the element with |element_id| in the passed |web_state| has |
13 // been tapped using a JavaScript click() event. | 30 // been tapped using a JavaScript click() event. |
14 bool TapWebViewElementWithId(web::WebState* web_state, | 31 bool TapWebViewElementWithId(web::WebState* web_state, |
15 const std::string& element_id); | 32 const std::string& element_id); |
16 | 33 |
17 // Returns whether the element with |element_id| in the passed |web_state| has | 34 // Returns whether the element with |element_id| in the passed |web_state| has |
18 // been focused using a JavaScript focus() event. | 35 // been focused using a JavaScript focus() event. |
19 bool FocusWebViewElementWithId(web::WebState* web_state, | 36 bool FocusWebViewElementWithId(web::WebState* web_state, |
20 const std::string& element_id); | 37 const std::string& element_id); |
21 | 38 |
22 // Returns whether the form with |form_id| in the passed |web_state| has been | 39 // Returns whether the form with |form_id| in the passed |web_state| has been |
23 // submitted using a JavaScript submit() event. | 40 // submitted using a JavaScript submit() event. |
24 bool SubmitWebViewFormWithId(web::WebState* web_state, | 41 bool SubmitWebViewFormWithId(web::WebState* web_state, |
25 const std::string& form_id); | 42 const std::string& form_id); |
26 } // namespace test | 43 } // namespace test |
27 } // namespace web | 44 } // namespace web |
OLD | NEW |