Chromium Code Reviews| Index: ios/web/public/test/web_view_interaction_test_util.mm |
| diff --git a/ios/web/public/test/web_view_interaction_test_util.mm b/ios/web/public/test/web_view_interaction_test_util.mm |
| index db4000300e857f21bb245d6c750af05017db6fbd..0892593c062af9f446a3938cc0ca0e822540e89e 100644 |
| --- a/ios/web/public/test/web_view_interaction_test_util.mm |
| +++ b/ios/web/public/test/web_view_interaction_test_util.mm |
| @@ -15,7 +15,11 @@ using web::NavigationManager; |
| namespace web { |
| namespace test { |
| -enum ElementAction { ELEMENT_ACTION_CLICK, ELEMENT_ACTION_FOCUS }; |
| +enum ElementAction { |
| + ELEMENT_ACTION_CLICK, |
| + ELEMENT_ACTION_FOCUS, |
| + ELEMENT_ACTION_SUBMIT |
|
Eugene But (OOO till 7-30)
2016/08/26 21:48:05
Optional NIT: Maybe add comma after last item to m
edchin
2016/08/26 22:26:54
I followed the convention already on the page. See
|
| +}; |
| // Returns whether the Javascript action specified by |action| ran on |
| // |element_id| in the passed |web_state|. |
| @@ -32,6 +36,9 @@ bool RunActionOnWebViewElementWithId(web::WebState* web_state, |
| case ELEMENT_ACTION_FOCUS: |
| js_action = ".focus();"; |
| break; |
| + case ELEMENT_ACTION_SUBMIT: |
| + js_action = ".submit();"; |
| + break; |
| } |
| NSString* script = [NSString |
| stringWithFormat:@"(function() {" |
| @@ -70,5 +77,11 @@ bool FocusWebViewElementWithId(web::WebState* web_state, |
| ELEMENT_ACTION_FOCUS); |
| } |
| +bool SubmitWebViewFormWithId(web::WebState* web_state, |
| + const std::string& form_id) { |
| + return RunActionOnWebViewElementWithId(web_state, form_id, |
| + ELEMENT_ACTION_SUBMIT); |
| +} |
| + |
| } // namespace test |
| } // namespace web |