Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Unified Diff: ios/web/public/test/web_view_interaction_test_util.mm

Issue 2283963002: Add ability to submit a form using javascript. (Closed)
Patch Set: more descriptive naming Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/public/test/web_view_interaction_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ios/web/public/test/web_view_interaction_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698