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 <XCTest/XCTest.h> | 5 #import <XCTest/XCTest.h> |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
9 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
10 #include "components/strings/grit/components_strings.h" | 11 #include "components/strings/grit/components_strings.h" |
11 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 12 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
12 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 13 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
13 #include "ios/chrome/browser/ui/ui_util.h" | 14 #include "ios/chrome/browser/ui/ui_util.h" |
14 #import "ios/chrome/test/app/chrome_test_util.h" | 15 #import "ios/chrome/test/app/chrome_test_util.h" |
15 #include "ios/chrome/test/app/navigation_test_util.h" | 16 #include "ios/chrome/test/app/navigation_test_util.h" |
16 #include "ios/chrome/test/app/web_view_interaction_test_util.h" | 17 #include "ios/chrome/test/app/web_view_interaction_test_util.h" |
17 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 18 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
18 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 19 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
19 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 20 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
20 #import "ios/testing/wait_util.h" | 21 #import "ios/testing/wait_util.h" |
21 #import "ios/web/public/test/http_server.h" | 22 #import "ios/web/public/test/http_server.h" |
22 #import "ios/web/public/test/http_server_util.h" | 23 #import "ios/web/public/test/http_server_util.h" |
23 #include "ios/web/public/test/response_providers/html_response_provider.h" | 24 #include "ios/web/public/test/response_providers/data_response_provider.h" |
24 #include "ios/web/public/test/response_providers/html_response_provider_impl.h" | |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // URL for a generic website in the user navigation flow. | 28 // URL for a generic website in the user navigation flow. |
29 const char kGenericUrl[] = "http://generic"; | 29 const char kGenericUrl[] = "http://generic"; |
30 | 30 |
31 // URL for the server to print the HTTP method and the request body. | 31 // URL to print the HTTP method and the request body. |
32 const char kPrintFormDataUrl[] = "http://printFormData"; | 32 const char kPrintFormDataUrl[] = "http://printFormData"; |
33 | 33 |
34 // URL for the server that redirects to kPrintPostData with a 302. | 34 // URL that redirects to kPrintPostData with a 302. |
35 const char kRedirectUrl[] = "http://redirect"; | 35 const char kRedirectUrl[] = "http://redirect"; |
36 | 36 |
37 // URL for the server to return a page that posts a form with some data to | 37 // URL to return a page that posts a form with some data to |
38 // |kPrintPostData|. | 38 // |kPrintPostData|. |
39 const char kFormUrl[] = "http://formURL"; | 39 const char kFormUrl[] = "http://formURL"; |
40 | 40 |
41 // URL for the server to return a page that posts to |kRedirect|. | 41 // URL to return a page that posts to |kRedirect|. |
42 const char kRedirectFormUrl[] = "http://redirectFormURL"; | 42 const char kRedirectFormUrl[] = "http://redirectFormURL"; |
43 | 43 |
44 // Label for the button in the form. | 44 // Label for the button in the form. |
45 const char kSubmitButton[] = "Submit"; | 45 const char kSubmitButton[] = "Submit"; |
46 | 46 |
47 // Expected response from the server. | 47 // Expected response from the server. |
48 const char kExpectedPostData[] = "POST Data=Unicorn"; | 48 const char kExpectedPostData[] = "POST Data=Unicorn"; |
49 | 49 |
| 50 #pragma mark - TestResponseProvider |
| 51 |
| 52 // A ResponseProvider that provides html response or a redirect. |
| 53 class TestResponseProvider : public web::DataResponseProvider { |
| 54 public: |
| 55 // URL for the server at |kGenericUrl|. |
| 56 static GURL GetGenericUrl() { |
| 57 return web::test::HttpServer::MakeUrl(kGenericUrl); |
| 58 } |
| 59 // URL for the server at |kPrintFormDataUrl|. |
| 60 static GURL GetPrintFormDataUrl() { |
| 61 return web::test::HttpServer::MakeUrl(kPrintFormDataUrl); |
| 62 } |
| 63 // URL for the server at |kRedirectUrl|. |
| 64 static GURL GetRedirectUrl() { |
| 65 return web::test::HttpServer::MakeUrl(kRedirectUrl); |
| 66 } |
| 67 // URL for the server at |kFormUrl|. |
| 68 static GURL GetFormUrl() { return web::test::HttpServer::MakeUrl(kFormUrl); } |
| 69 // URL for the server at |kRedirectFormUrl|. |
| 70 static GURL GetRedirectFormUrl() { |
| 71 return web::test::HttpServer::MakeUrl(kRedirectFormUrl); |
| 72 } |
| 73 // TestResponseProvider implementation. |
| 74 bool CanHandleRequest(const Request& request) override; |
| 75 void GetResponseHeadersAndBody( |
| 76 const Request& request, |
| 77 scoped_refptr<net::HttpResponseHeaders>* headers, |
| 78 std::string* response_body) override; |
| 79 }; |
| 80 |
| 81 bool TestResponseProvider::CanHandleRequest(const Request& request) { |
| 82 const GURL& url = request.url; |
| 83 return url == TestResponseProvider::GetPrintFormDataUrl() || |
| 84 url == TestResponseProvider::GetRedirectUrl() || |
| 85 url == TestResponseProvider::GetFormUrl() || |
| 86 url == TestResponseProvider::GetRedirectFormUrl(); |
| 87 } |
| 88 |
| 89 void TestResponseProvider::GetResponseHeadersAndBody( |
| 90 const Request& request, |
| 91 scoped_refptr<net::HttpResponseHeaders>* headers, |
| 92 std::string* response_body) { |
| 93 const GURL& url = request.url; |
| 94 if (url == TestResponseProvider::GetRedirectUrl()) { |
| 95 *headers = web::ResponseProvider::GetRedirectResponseHeaders( |
| 96 TestResponseProvider::GetPrintFormDataUrl().spec(), net::HTTP_FOUND); |
| 97 return; |
| 98 } |
| 99 |
| 100 const char* form_html = |
| 101 "<form method=\"post\" action=\"%s\">" |
| 102 "<textarea rows=\"1\" name=\"Data\">Unicorn</textarea>" |
| 103 "<input type=\"submit\" value=\"%s\" id=\"%s\">" |
| 104 "</form>"; |
| 105 |
| 106 *headers = web::ResponseProvider::GetDefaultResponseHeaders(); |
| 107 if (url == TestResponseProvider::GetFormUrl()) { |
| 108 *response_body = base::StringPrintf( |
| 109 form_html, TestResponseProvider::GetPrintFormDataUrl().spec().c_str(), |
| 110 kSubmitButton, kSubmitButton); |
| 111 return; |
| 112 } else if (url == TestResponseProvider::GetRedirectFormUrl()) { |
| 113 *response_body = base::StringPrintf( |
| 114 form_html, TestResponseProvider::GetRedirectUrl().spec().c_str(), |
| 115 kSubmitButton, kSubmitButton); |
| 116 return; |
| 117 } else if (url == TestResponseProvider::GetPrintFormDataUrl()) { |
| 118 *response_body = request.method + std::string(" ") + request.body; |
| 119 return; |
| 120 } |
| 121 NOTREACHED(); |
| 122 } |
| 123 |
50 } // namespace | 124 } // namespace |
51 | 125 |
52 // Tests submition of HTTP forms POST data including cases involving navigation. | 126 // Tests submition of HTTP forms POST data including cases involving navigation. |
53 @interface FormsTestCase : ChromeTestCase | 127 @interface FormsTestCase : ChromeTestCase |
54 @end | 128 @end |
55 | 129 |
56 @implementation FormsTestCase | 130 @implementation FormsTestCase |
57 | 131 |
58 // Sets up server urls and responses. | 132 // Sets up server urls and responses. |
59 - (void)setUp { | 133 - (void)setUp { |
60 [super setUp]; | 134 [super setUp]; |
61 std::map<GURL, HtmlResponseProviderImpl::Response> responses; | |
62 | 135 |
63 const char* formHtml = | 136 web::test::SetUpHttpServer(base::MakeUnique<TestResponseProvider>()); |
64 "<form method=\"post\" action=\"%s\">" | |
65 "<textarea rows=\"1\" name=\"Data\">Unicorn</textarea>" | |
66 "<input type=\"submit\" value=\"%s\" id=\"%s\">" | |
67 "</form>"; | |
68 GURL printFormDataUrl = web::test::HttpServer::MakeUrl(kPrintFormDataUrl); | |
69 | |
70 const GURL formUrl = web::test::HttpServer::MakeUrl(kFormUrl); | |
71 responses[formUrl] = HtmlResponseProviderImpl::GetSimpleResponse( | |
72 base::StringPrintf(formHtml, printFormDataUrl.spec().c_str(), | |
73 kSubmitButton, kSubmitButton)); | |
74 | |
75 const GURL redirectFormUrl = web::test::HttpServer::MakeUrl(kRedirectFormUrl); | |
76 const std::string redirectFormResponse = base::StringPrintf( | |
77 formHtml, web::test::HttpServer::MakeUrl(kRedirectUrl).spec().c_str(), | |
78 kSubmitButton, kSubmitButton); | |
79 responses[redirectFormUrl] = | |
80 HtmlResponseProviderImpl::GetSimpleResponse(redirectFormResponse); | |
81 | |
82 const GURL redirectUrl = web::test::HttpServer::MakeUrl(kRedirectUrl); | |
83 responses[redirectUrl] = HtmlResponseProviderImpl::GetRedirectResponse( | |
84 printFormDataUrl, net::HTTP_FOUND); | |
85 | |
86 std::unique_ptr<web::DataResponseProvider> provider( | |
87 new HtmlResponseProvider(responses)); | |
88 web::test::SetUpHttpServer(std::move(provider)); | |
89 } | 137 } |
90 | 138 |
91 // Submits the html form and verifies the destination url. | 139 // Submits the html form and verifies the destination url. |
92 - (void)submitForm { | 140 - (void)submitForm { |
93 chrome_test_util::TapWebViewElementWithId(kSubmitButton); | 141 chrome_test_util::TapWebViewElementWithId(kSubmitButton); |
94 | 142 |
95 GURL url = web::test::HttpServer::MakeUrl(kPrintFormDataUrl); | 143 GURL url = TestResponseProvider::GetPrintFormDataUrl(); |
96 id<GREYMatcher> URLMatcher = chrome_test_util::OmniboxText(url.GetContent()); | 144 id<GREYMatcher> URLMatcher = chrome_test_util::OmniboxText(url.GetContent()); |
97 [[EarlGrey selectElementWithMatcher:URLMatcher] | 145 [[EarlGrey selectElementWithMatcher:URLMatcher] |
98 assertWithMatcher:grey_notNil()]; | 146 assertWithMatcher:grey_notNil()]; |
99 } | 147 } |
100 | 148 |
101 // Waits for the |expectedResponse| within the web view. | 149 // Waits for the |expectedResponse| within the web view. |
102 - (void)waitForExpectedResponse:(std::string)expectedResponse { | 150 - (void)waitForExpectedResponse:(std::string)expectedResponse { |
103 [[GREYCondition | 151 GREYCondition* condition = [GREYCondition |
104 conditionWithName:@"Waiting for webview to display resulting text." | 152 conditionWithName:@"Waiting for webview to display resulting text." |
105 block:^BOOL { | 153 block:^BOOL { |
106 id<GREYMatcher> webViewMatcher = | 154 id<GREYMatcher> webViewMatcher = |
107 chrome_test_util::WebViewContainingText( | 155 chrome_test_util::WebViewContainingText( |
108 expectedResponse); | 156 expectedResponse); |
109 NSError* error = nil; | 157 NSError* error = nil; |
110 [[EarlGrey selectElementWithMatcher:webViewMatcher] | 158 [[EarlGrey selectElementWithMatcher:webViewMatcher] |
111 assertWithMatcher:grey_notNil() | 159 assertWithMatcher:grey_notNil() |
112 error:&error]; | 160 error:&error]; |
113 return error == nil; | 161 return error == nil; |
114 }] waitWithTimeout:5]; | 162 }]; |
| 163 GREYAssert([condition waitWithTimeout:5], @"Webview text was not displayed."); |
115 } | 164 } |
116 | 165 |
117 // Waits for view with Tab History accessibility ID. | 166 // Waits for view with Tab History accessibility ID. |
118 - (void)waitForTabHistoryView { | 167 - (void)waitForTabHistoryView { |
119 [[GREYCondition conditionWithName:@"Waiting for Tab History to display." | 168 GREYCondition* condition = [GREYCondition |
120 block:^BOOL { | 169 conditionWithName:@"Waiting for Tab History to display." |
121 NSError* error = nil; | 170 block:^BOOL { |
122 id<GREYMatcher> tabHistory = | 171 NSError* error = nil; |
123 grey_accessibilityID(@"Tab History"); | 172 id<GREYMatcher> tabHistory = |
124 [[EarlGrey selectElementWithMatcher:tabHistory] | 173 grey_accessibilityID(@"Tab History"); |
125 assertWithMatcher:grey_notNil() | 174 [[EarlGrey selectElementWithMatcher:tabHistory] |
126 error:&error]; | 175 assertWithMatcher:grey_notNil() |
127 return error == nil; | 176 error:&error]; |
128 }] waitWithTimeout:5]; | 177 return error == nil; |
| 178 }]; |
| 179 GREYAssert([condition waitWithTimeout:5], @"Tab History View not displayed."); |
129 } | 180 } |
130 | 181 |
131 // Reloads the web view and waits for the loading to complete. | 182 // Reloads the web view and waits for the loading to complete. |
132 // TODO(crbug.com/638674): Evaluate if this can move to shared code | 183 // TODO(crbug.com/638674): Evaluate if this can move to shared code |
133 - (void)reloadPage { | 184 - (void)reloadPage { |
134 base::scoped_nsobject<GenericChromeCommand> reloadCommand( | 185 base::scoped_nsobject<GenericChromeCommand> reloadCommand( |
135 [[GenericChromeCommand alloc] initWithTag:IDC_RELOAD]); | 186 [[GenericChromeCommand alloc] initWithTag:IDC_RELOAD]); |
136 chrome_test_util::RunCommandWithActiveViewController(reloadCommand); | 187 chrome_test_util::RunCommandWithActiveViewController(reloadCommand); |
137 | 188 |
138 [ChromeEarlGrey waitForPageToFinishLoading]; | 189 [ChromeEarlGrey waitForPageToFinishLoading]; |
(...skipping 28 matching lines...) Expand all Loading... |
167 - (void)confirmResendWarning { | 218 - (void)confirmResendWarning { |
168 id<GREYMatcher> resendWarning = | 219 id<GREYMatcher> resendWarning = |
169 chrome_test_util::ButtonWithAccessibilityLabelId( | 220 chrome_test_util::ButtonWithAccessibilityLabelId( |
170 IDS_HTTP_POST_WARNING_RESEND); | 221 IDS_HTTP_POST_WARNING_RESEND); |
171 [[EarlGrey selectElementWithMatcher:resendWarning] | 222 [[EarlGrey selectElementWithMatcher:resendWarning] |
172 performAction:grey_longPress()]; | 223 performAction:grey_longPress()]; |
173 } | 224 } |
174 | 225 |
175 // Tests whether the request data is reposted correctly. | 226 // Tests whether the request data is reposted correctly. |
176 - (void)testRepostForm { | 227 - (void)testRepostForm { |
177 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kFormUrl)]; | 228 [ChromeEarlGrey loadURL:TestResponseProvider::GetFormUrl()]; |
178 | 229 |
179 [self submitForm]; | 230 [self submitForm]; |
180 [self waitForExpectedResponse:kExpectedPostData]; | 231 [self waitForExpectedResponse:kExpectedPostData]; |
181 | 232 |
182 [self reloadPage]; | 233 [self reloadPage]; |
183 [self confirmResendWarning]; | 234 [self confirmResendWarning]; |
184 | 235 |
185 [self waitForExpectedResponse:kExpectedPostData]; | 236 [self waitForExpectedResponse:kExpectedPostData]; |
186 } | 237 } |
187 | 238 |
188 // Tests that a POST followed by navigating to a new page and then tapping back | 239 // Tests that a POST followed by navigating to a new page and then tapping back |
189 // to the form result page resends data. | 240 // to the form result page resends data. |
190 - (void)testRepostFormAfterTappingBack { | 241 - (void)testRepostFormAfterTappingBack { |
191 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kFormUrl)]; | 242 [ChromeEarlGrey loadURL:TestResponseProvider::GetFormUrl()]; |
192 | 243 |
193 [self submitForm]; | 244 [self submitForm]; |
194 | 245 |
195 // Go to a new page. | 246 // Go to a new page. |
196 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kGenericUrl)]; | 247 [ChromeEarlGrey loadURL:TestResponseProvider::GetGenericUrl()]; |
197 | 248 |
198 // Go back and check that the data is reposted. | 249 // Go back and check that the data is reposted. |
199 [self goBack]; | 250 [self goBack]; |
200 [self confirmResendWarning]; | 251 [self confirmResendWarning]; |
201 [self waitForExpectedResponse:kExpectedPostData]; | 252 [self waitForExpectedResponse:kExpectedPostData]; |
202 } | 253 } |
203 | 254 |
204 // Tests that a POST followed by tapping back to the form page and then tapping | 255 // Tests that a POST followed by tapping back to the form page and then tapping |
205 // forward to the result page resends data. | 256 // forward to the result page resends data. |
206 - (void)testRepostFormAfterTappingBackAndForward { | 257 - (void)testRepostFormAfterTappingBackAndForward { |
207 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kFormUrl)]; | 258 [ChromeEarlGrey loadURL:TestResponseProvider::GetFormUrl()]; |
208 [self submitForm]; | 259 [self submitForm]; |
209 | 260 |
210 [self goBack]; | 261 [self goBack]; |
211 [self goForward]; | 262 [self goForward]; |
212 [self confirmResendWarning]; | 263 [self confirmResendWarning]; |
213 [self waitForExpectedResponse:kExpectedPostData]; | 264 [self waitForExpectedResponse:kExpectedPostData]; |
214 } | 265 } |
215 | 266 |
216 // Tests that a POST followed by a new request and then index navigation to get | 267 // Tests that a POST followed by a new request and then index navigation to get |
217 // back to the result page resends data. | 268 // back to the result page resends data. |
218 - (void)testRepostFormAfterIndexNavigation { | 269 - (void)testRepostFormAfterIndexNavigation { |
219 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kFormUrl)]; | 270 [ChromeEarlGrey loadURL:TestResponseProvider::GetFormUrl()]; |
220 [self submitForm]; | 271 [self submitForm]; |
221 | 272 |
222 // Go to a new page. | 273 // Go to a new page. |
223 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kGenericUrl)]; | 274 [ChromeEarlGrey loadURL:TestResponseProvider::GetGenericUrl()]; |
224 | 275 |
225 [self openBackHistory]; | 276 [self openBackHistory]; |
226 [self waitForTabHistoryView]; | 277 [self waitForTabHistoryView]; |
227 | 278 |
228 const GURL printURL = web::test::HttpServer::MakeUrl(kPrintFormDataUrl); | 279 id<GREYMatcher> historyItem = grey_text(base::SysUTF8ToNSString( |
229 id<GREYMatcher> historyItem = | 280 TestResponseProvider::GetPrintFormDataUrl().spec())); |
230 grey_text(base::SysUTF8ToNSString(printURL.spec())); | |
231 [[EarlGrey selectElementWithMatcher:historyItem] performAction:grey_tap()]; | 281 [[EarlGrey selectElementWithMatcher:historyItem] performAction:grey_tap()]; |
232 | 282 |
233 [ChromeEarlGrey waitForPageToFinishLoading]; | 283 [ChromeEarlGrey waitForPageToFinishLoading]; |
234 | 284 |
235 [self confirmResendWarning]; | 285 [self confirmResendWarning]; |
236 [self waitForExpectedResponse:kExpectedPostData]; | 286 [self waitForExpectedResponse:kExpectedPostData]; |
237 } | 287 } |
238 | 288 |
239 // When data is not re-sent, the request is done with a GET method. | 289 // When data is not re-sent, the request is done with a GET method. |
240 - (void)testRepostFormCancelling { | 290 - (void)testRepostFormCancelling { |
241 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kFormUrl)]; | 291 [ChromeEarlGrey loadURL:TestResponseProvider::GetFormUrl()]; |
242 [self submitForm]; | 292 [self submitForm]; |
243 | 293 |
244 [self reloadPage]; | 294 [self reloadPage]; |
245 | 295 |
246 // Abort the reload. | 296 // Abort the reload. |
247 if (IsIPadIdiom()) { | 297 if (IsIPadIdiom()) { |
248 // On tablet, dismiss the popover. | 298 // On tablet, dismiss the popover. |
249 base::scoped_nsobject<GREYElementMatcherBlock> matcher([ | 299 base::scoped_nsobject<GREYElementMatcherBlock> matcher([ |
250 [GREYElementMatcherBlock alloc] | 300 [GREYElementMatcherBlock alloc] |
251 initWithMatchesBlock:^BOOL(UIView* view) { | 301 initWithMatchesBlock:^BOOL(UIView* view) { |
252 return [NSStringFromClass([view class]) hasPrefix:@"UIDimmingView"]; | 302 return [NSStringFromClass([view class]) hasPrefix:@"UIDimmingView"]; |
253 } | 303 } |
254 descriptionBlock:^(id<GREYDescription> description) { | 304 descriptionBlock:^(id<GREYDescription> description) { |
255 [description appendText:@"class prefixed with UIDimmingView"]; | 305 [description appendText:@"class prefixed with UIDimmingView"]; |
256 }]); | 306 }]); |
257 [[EarlGrey selectElementWithMatcher:matcher] | 307 [[EarlGrey selectElementWithMatcher:matcher] |
258 performAction:grey_tapAtPoint(CGPointMake(50.0f, 50.0f))]; | 308 performAction:grey_tapAtPoint(CGPointMake(50.0f, 50.0f))]; |
259 } else { | 309 } else { |
260 // On handset, dismiss via the cancel button. | 310 // On handset, dismiss via the cancel button. |
261 [[EarlGrey selectElementWithMatcher:chrome_test_util::CancelButton()] | 311 [[EarlGrey selectElementWithMatcher:chrome_test_util::CancelButton()] |
262 performAction:grey_tap()]; | 312 performAction:grey_tap()]; |
263 } | 313 } |
264 // Check that the POST is changed to a GET | 314 // Check that the POST is changed to a GET |
265 [self waitForExpectedResponse:"GET"]; | 315 [self waitForExpectedResponse:"GET"]; |
266 } | 316 } |
267 | 317 |
268 // Tests that a POST followed by a redirect does not show the popup. | 318 // Tests that a POST followed by a redirect does not show the popup. |
269 - (void)testRepostFormCancellingAfterRedirect { | 319 - (void)testRepostFormCancellingAfterRedirect { |
270 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kRedirectFormUrl)]; | 320 [ChromeEarlGrey loadURL:TestResponseProvider::GetRedirectFormUrl()]; |
271 // Submit the form, which redirects before printing the data. | 321 // Submit the form, which redirects before printing the data. |
272 [self submitForm]; | 322 [self submitForm]; |
273 // Check that the redirect changes the POST to a GET. | 323 // Check that the redirect changes the POST to a GET. |
274 [self waitForExpectedResponse:"GET"]; | 324 [self waitForExpectedResponse:"GET"]; |
275 [self reloadPage]; | 325 [self reloadPage]; |
276 | 326 |
277 // Check that the popup did not show | 327 // Check that the popup did not show |
278 id<GREYMatcher> resendWarning = | 328 id<GREYMatcher> resendWarning = |
279 chrome_test_util::ButtonWithAccessibilityLabelId( | 329 chrome_test_util::ButtonWithAccessibilityLabelId( |
280 IDS_HTTP_POST_WARNING_RESEND); | 330 IDS_HTTP_POST_WARNING_RESEND); |
281 [[EarlGrey selectElementWithMatcher:resendWarning] | 331 [[EarlGrey selectElementWithMatcher:resendWarning] |
282 assertWithMatcher:grey_nil()]; | 332 assertWithMatcher:grey_nil()]; |
283 | 333 |
284 [self waitForExpectedResponse:"GET"]; | 334 [self waitForExpectedResponse:"GET"]; |
285 } | 335 } |
286 | 336 |
287 @end | 337 @end |
OLD | NEW |