Commit fcd81337 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][MF][EG2] Migrate Password JS test

TBR=eugenebut@chromium.org

Bug: 1016368,   1016367
Change-Id: Id1596414616fc839472a85c1a7db1b66a717acd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886899
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Auto-Submit: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710346}
parent 1e7c2506
...@@ -46,12 +46,7 @@ const char kFormElementPassword[] = "password"; ...@@ -46,12 +46,7 @@ const char kFormElementPassword[] = "password";
const char kExampleUsername[] = "concrete username"; const char kExampleUsername[] = "concrete username";
const char kFormHTMLFile[] = "/username_password_field_form.html"; const char kFormHTMLFile[] = "/username_password_field_form.html";
// TODO(crbug.com/1016367): Remove the guard once ExecuteJavaScript is updated
// to compile on EG2.
#if defined(CHROME_EARL_GREY_1)
const char kIFrameHTMLFile[] = "/iframe_form.html"; const char kIFrameHTMLFile[] = "/iframe_form.html";
#endif // CHROME_EARL_GREY_1
// Returns a matcher for the example username in the list. // Returns a matcher for the example username in the list.
id<GREYMatcher> UsernameButtonMatcher() { id<GREYMatcher> UsernameButtonMatcher() {
...@@ -64,14 +59,11 @@ id<GREYMatcher> NotSecureWebsiteAlert() { ...@@ -64,14 +59,11 @@ id<GREYMatcher> NotSecureWebsiteAlert() {
IDS_IOS_MANUAL_FALLBACK_NOT_SECURE_TITLE); IDS_IOS_MANUAL_FALLBACK_NOT_SECURE_TITLE);
} }
// TODO(crbug.com/1016367): Remove the guard once ExecuteJavaScript is updated
// to compile on EG2.
#if defined(CHROME_EARL_GREY_1)
// Polls the JavaScript query |java_script_condition| until the returned // Polls the JavaScript query |java_script_condition| until the returned
// |boolValue| is YES with a kWaitForActionTimeout timeout. // |boolValue| is YES with a kWaitForActionTimeout timeout.
BOOL WaitForJavaScriptCondition(NSString* java_script_condition) { BOOL WaitForJavaScriptCondition(NSString* java_script_condition) {
auto verify_block = ^BOOL { auto verify_block = ^BOOL {
id value = chrome_test_util::ExecuteJavaScript(java_script_condition, nil); id value = [ChromeEarlGrey executeJavaScript:java_script_condition];
return [value isEqual:@YES]; return [value isEqual:@YES];
}; };
NSTimeInterval timeout = base::test::ios::kWaitForActionTimeout; NSTimeInterval timeout = base::test::ios::kWaitForActionTimeout;
...@@ -81,7 +73,6 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) { ...@@ -81,7 +73,6 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) {
[GREYCondition conditionWithName:condition_name block:verify_block]; [GREYCondition conditionWithName:condition_name block:verify_block];
return [condition waitWithTimeout:timeout]; return [condition waitWithTimeout:timeout];
} }
#endif // CHROME_EARL_GREY_1
} // namespace } // namespace
...@@ -498,9 +489,6 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) { ...@@ -498,9 +489,6 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) {
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
} }
// TODO(crbug.com/1016367): Remove the guard of this test when ExecuteJavaScript
// util is updated for EG2.
#if defined(CHROME_EARL_GREY_1)
// Tests that content is injected in iframe messaging. // Tests that content is injected in iframe messaging.
- (void)testPasswordControllerSupportsIFrameMessaging { - (void)testPasswordControllerSupportsIFrameMessaging {
const GURL URL = self.testServer->GetURL(kIFrameHTMLFile); const GURL URL = self.testServer->GetURL(kIFrameHTMLFile);
...@@ -536,7 +524,6 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) { ...@@ -536,7 +524,6 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) {
kFormElementUsername, kExampleUsername]; kFormElementUsername, kExampleUsername];
XCTAssertTrue(WaitForJavaScriptCondition(javaScriptCondition)); XCTAssertTrue(WaitForJavaScriptCondition(javaScriptCondition));
} }
#endif // CHROME_EARL_GREY_1
// Tests that an alert is shown when trying to fill a password in an unsecure // Tests that an alert is shown when trying to fill a password in an unsecure
// field. // field.
......
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