| 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/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 initWithMatchesBlock:^BOOL(UIView* view) { | 252 initWithMatchesBlock:^BOOL(UIView* view) { |
| 253 return [NSStringFromClass([view class]) hasPrefix:@"UIDimmingView"]; | 253 return [NSStringFromClass([view class]) hasPrefix:@"UIDimmingView"]; |
| 254 } | 254 } |
| 255 descriptionBlock:^(id<GREYDescription> description) { | 255 descriptionBlock:^(id<GREYDescription> description) { |
| 256 [description appendText:@"class prefixed with UIDimmingView"]; | 256 [description appendText:@"class prefixed with UIDimmingView"]; |
| 257 }]); | 257 }]); |
| 258 [[EarlGrey selectElementWithMatcher:matcher] | 258 [[EarlGrey selectElementWithMatcher:matcher] |
| 259 performAction:grey_tapAtPoint(CGPointMake(50.0f, 50.0f))]; | 259 performAction:grey_tapAtPoint(CGPointMake(50.0f, 50.0f))]; |
| 260 } else { | 260 } else { |
| 261 // On handset, dismiss via the cancel button. | 261 // On handset, dismiss via the cancel button. |
| 262 id<GREYMatcher> cancel = | 262 [[EarlGrey selectElementWithMatcher:chrome_test_util::cancelButton()] |
| 263 chrome_test_util::buttonWithAccessibilityLabelId(IDS_CANCEL); | 263 performAction:grey_tap()]; |
| 264 [[EarlGrey selectElementWithMatcher:cancel] performAction:grey_tap()]; | |
| 265 } | 264 } |
| 266 // Check that the POST is changed to a GET | 265 // Check that the POST is changed to a GET |
| 267 [self waitForExpectedResponse:"GET"]; | 266 [self waitForExpectedResponse:"GET"]; |
| 268 } | 267 } |
| 269 | 268 |
| 270 // Tests that a POST followed by a redirect does not show the popup. | 269 // Tests that a POST followed by a redirect does not show the popup. |
| 271 - (void)testFormsDontResendPostDataAfterRedirect { | 270 - (void)testFormsDontResendPostDataAfterRedirect { |
| 272 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kRedirectFormUrl)]; | 271 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kRedirectFormUrl)]; |
| 273 // Submit the form, which redirects before printing the data. | 272 // Submit the form, which redirects before printing the data. |
| 274 [self submitForm]; | 273 [self submitForm]; |
| 275 // Check that the redirect changes the POST to a GET. | 274 // Check that the redirect changes the POST to a GET. |
| 276 [self waitForExpectedResponse:"GET"]; | 275 [self waitForExpectedResponse:"GET"]; |
| 277 [self reloadPage]; | 276 [self reloadPage]; |
| 278 | 277 |
| 279 // Check that the popup did not show | 278 // Check that the popup did not show |
| 280 id<GREYMatcher> resendWarning = | 279 id<GREYMatcher> resendWarning = |
| 281 chrome_test_util::buttonWithAccessibilityLabelId( | 280 chrome_test_util::buttonWithAccessibilityLabelId( |
| 282 IDS_HTTP_POST_WARNING_RESEND); | 281 IDS_HTTP_POST_WARNING_RESEND); |
| 283 [[EarlGrey selectElementWithMatcher:resendWarning] | 282 [[EarlGrey selectElementWithMatcher:resendWarning] |
| 284 assertWithMatcher:grey_nil()]; | 283 assertWithMatcher:grey_nil()]; |
| 285 | 284 |
| 286 [self waitForExpectedResponse:"GET"]; | 285 [self waitForExpectedResponse:"GET"]; |
| 287 } | 286 } |
| 288 | 287 |
| 289 @end | 288 @end |
| OLD | NEW |