Commit 95a82a9b authored by vasilii's avatar vasilii Committed by Commit Bot

Increase test coverage of "Show All" manual fallback for passwords.

Bug: 782287
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I534f2b892efe8d2af08bbea6ee724c38509a55c9
Reviewed-on: https://chromium-review.googlesource.com/926581Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539102}
parent 9e25952f
......@@ -1276,7 +1276,11 @@ TEST_F(PasswordControllerTest, SelectingSuggestionShouldFillPasswordForm) {
webState:web_state()
completionHandler:^(NSArray* suggestions,
id<FormSuggestionProvider> provider) {
EXPECT_EQ(2u, [suggestions count]);
NSMutableArray* suggestion_values = [NSMutableArray array];
for (FormSuggestion* suggestion in suggestions)
[suggestion_values addObject:suggestion.value];
EXPECT_NSEQ((@[ @"abc", @"Show All\u2026" ]),
suggestion_values);
block_was_called = YES;
}];
EXPECT_TRUE(block_was_called);
......
......@@ -374,6 +374,7 @@ source_set("eg_tests") {
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web",
"//ios/web:earl_grey_test_support",
"//ios/web/public/test",
"//ios/web/public/test/http_server",
"//net",
......
......@@ -35,6 +35,10 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/wait_util.h"
#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h"
#include "ios/web/public/test/earl_grey/web_view_actions.h"
#include "ios/web/public/test/earl_grey/web_view_matchers.h"
#include "ios/web/public/test/http_server/http_server.h"
#include "ios/web/public/test/http_server/http_server_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
#include "url/origin.h"
......@@ -1535,4 +1539,45 @@ PasswordForm CreateSampleFormWithIndex(int index) {
performAction:grey_tap()];
}
// Opens a page with password input, focuses it, clocks "Show All" in the
// keyboard accessory and verifies that the password list is presented.
- (void)testOpenSettingsFromManualFallback {
// Saving a form is needed for using the "password details" view.
SaveExamplePasswordForm();
const GURL kPasswordURL(web::test::HttpServer::MakeUrl("http://form/"));
std::map<GURL, std::string> responses;
responses[kPasswordURL] = "<input id='password' type='password'>";
web::test::SetUpSimpleHttpServer(responses);
[ChromeEarlGrey loadURL:kPasswordURL];
// Focus the password field.
// Brings up the keyboard by tapping on one of the form's field.
[[EarlGrey
selectElementWithMatcher:web::WebViewInWebState(
chrome_test_util::GetCurrentWebState())]
performAction:web::WebViewTapElement(
chrome_test_util::GetCurrentWebState(), "password")];
// Wait until the keyboard shows up before tapping.
id<GREYMatcher> showAll = grey_allOf(
grey_accessibilityLabel(@"Show All\u2026"), grey_interactable(), nil);
GREYCondition* condition =
[GREYCondition conditionWithName:@"Wait for the keyboard to show up."
block:^BOOL {
NSError* error = nil;
[[EarlGrey selectElementWithMatcher:showAll]
assertWithMatcher:grey_notNil()
error:&error];
return (error == nil);
}];
GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
@"No keyboard with 'Show All' button showed up.");
[[EarlGrey selectElementWithMatcher:showAll] performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel(
@"example.com, concrete username")]
assertWithMatcher:grey_notNil()];
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment