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

Side by Side Diff: ios/chrome/browser/web/forms_egtest.mm

Issue 2806743004: Fixing testBrowsingPostEntryWithButton flakiness. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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/memory/ptr_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Check that the popup did not show 339 // Check that the popup did not show
340 id<GREYMatcher> resendWarning = 340 id<GREYMatcher> resendWarning =
341 chrome_test_util::ButtonWithAccessibilityLabelId( 341 chrome_test_util::ButtonWithAccessibilityLabelId(
342 IDS_HTTP_POST_WARNING_RESEND); 342 IDS_HTTP_POST_WARNING_RESEND);
343 [[EarlGrey selectElementWithMatcher:resendWarning] 343 [[EarlGrey selectElementWithMatcher:resendWarning]
344 assertWithMatcher:grey_nil()]; 344 assertWithMatcher:grey_nil()];
345 345
346 [self waitForExpectedResponse:"GET"]; 346 [self waitForExpectedResponse:"GET"];
347 } 347 }
348 348
349 // Tests that pressing the button on a POST-based form changes the page and that
350 // the back button works as expected afterwards.
351 - (void)testGoBackButtonAfterFormSubmission {
352 // Create map of canned responses and set up the test HTML server.
353 std::map<GURL, std::string> responses;
354 const GURL URL = web::test::HttpServer::MakeUrl("http://postEntryWithButton");
355 const GURL destinationURL = web::test::HttpServer::MakeUrl("http://foo");
356 // This is a page with a button that posts to the destination.
357 responses[URL] = base::StringPrintf(
358 "<form action='%s' method='post'>"
359 "<input value='button' type='submit' id='button'></form>",
360 destinationURL.spec().c_str());
361 // This is the page that should be showing at the end of the test.
362 responses[destinationURL] = "bar!";
363 web::test::SetUpSimpleHttpServer(responses);
364
365 [ChromeEarlGrey loadURL:URL];
366 chrome_test_util::TapWebViewElementWithId("button");
367 [ChromeEarlGrey
368 waitForOmniboxText:base::SysUTF8ToNSString(destinationURL.GetContent())];
Eugene But (OOO till 7-30) 2017/04/08 00:16:27 Should |waitForOmniboxText:| take std::string inst
liaoyuke 2017/04/08 00:43:07 Yeah, I thought about that, but I went with NSStri
Eugene But (OOO till 7-30) 2017/04/08 00:55:09 Should we lean towards API convenience rather that
369
370 // Go back and verify the browser navigates to the original URL.
371 [self goBack];
372 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())]
373 assertWithMatcher:grey_notNil()];
374 }
375
349 @end 376 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698