Chromium Code Reviews| Index: ios/chrome/browser/web/forms_egtest.mm |
| diff --git a/ios/chrome/browser/web/forms_egtest.mm b/ios/chrome/browser/web/forms_egtest.mm |
| index 2210492ffa19019a3b7cd16d853daf33248f394a..ca9cf191045448aeac457b45255d1e32a6155cab 100644 |
| --- a/ios/chrome/browser/web/forms_egtest.mm |
| +++ b/ios/chrome/browser/web/forms_egtest.mm |
| @@ -24,6 +24,9 @@ |
| #include "ios/web/public/test/response_providers/data_response_provider.h" |
| #include "ios/web/public/test/url_test_util.h" |
| +using chrome_test_util::OmniboxText; |
| +using chrome_test_util::WebViewContainingText; |
| + |
| namespace { |
| // URL for a generic website in the user navigation flow. |
| @@ -124,8 +127,6 @@ void GetResponseHeadersAndBody( |
| } // namespace |
| -using chrome_test_util::OmniboxText; |
| - |
| // Tests submition of HTTP forms POST data including cases involving navigation. |
| @interface FormsTestCase : ChromeTestCase |
| @end |
| @@ -346,4 +347,25 @@ - (void)testRepostFormCancellingAfterRedirect { |
| [self waitForExpectedResponse:"GET"]; |
| } |
| +// Tests that pressing the button on a POST-based form changes the page and that |
| +// the back button works as expected afterwards. |
| +- (void)testGoBackButtonAfterFormSubmission { |
| + GURL formURL = TestResponseProvider::GetFormUrl(); |
| + GURL destinationURL = TestResponseProvider::GetPrintFormDataUrl(); |
| + |
| + [ChromeEarlGrey loadURL:formURL]; |
| + chrome_test_util::TapWebViewElementWithId(kSubmitButton); |
| + [[EarlGrey selectElementWithMatcher:WebViewContainingText(kExpectedPostData)] |
|
gchatz
2017/04/10 18:43:23
Should this use [self waitForExpectedResponse]?
liaoyuke
2017/04/10 18:48:09
I think we should remove this method (in a separat
gchatz
2017/04/10 20:46:10
Ok sounds good
Eugene But (OOO till 7-30)
2017/04/10 20:46:45
Could you please file a bug and add a TODO for thi
|
| + assertWithMatcher:grey_notNil()]; |
| + [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| + assertWithMatcher:grey_notNil()]; |
| + |
| + // Go back and verify the browser navigates to the original URL. |
| + [self goBack]; |
| + [[EarlGrey selectElementWithMatcher:WebViewContainingText("Unicorn")] |
| + assertWithMatcher:grey_notNil()]; |
| + [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] |
| + assertWithMatcher:grey_notNil()]; |
| +} |
| + |
| @end |