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

Side by Side Diff: ios/chrome/browser/autofill/form_input_egtest.mm

Issue 2642193012: Make EarlGrey matchers compliant with Chromium style. (Closed)
Patch Set: build.gn and rebase Created 3 years, 11 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
« no previous file with comments | « no previous file | ios/chrome/browser/context_menu/context_menu_egtest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <EarlGrey/EarlGrey.h> 5 #import <EarlGrey/EarlGrey.h>
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #import "base/test/ios/wait_util.h" 8 #import "base/test/ios/wait_util.h"
9 #include "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" 9 #include "ios/chrome/browser/autofill/form_input_accessory_view_controller.h"
10 #include "ios/chrome/browser/ui/ui_util.h" 10 #include "ios/chrome/browser/ui/ui_util.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (IsIPadIdiom()) { 78 if (IsIPadIdiom()) {
79 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no hidden toolbar in tablet)"); 79 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no hidden toolbar in tablet)");
80 } 80 }
81 81
82 web::test::SetUpFileBasedHttpServer(); 82 web::test::SetUpFileBasedHttpServer();
83 GURL URL = web::test::HttpServer::MakeUrl( 83 GURL URL = web::test::HttpServer::MakeUrl(
84 "http://ios/testing/data/http_server_files/multi_field_form.html"); 84 "http://ios/testing/data/http_server_files/multi_field_form.html");
85 [ChromeEarlGrey loadURL:URL]; 85 [ChromeEarlGrey loadURL:URL];
86 86
87 id<GREYMatcher> webViewMatcher = 87 id<GREYMatcher> webViewMatcher =
88 chrome_test_util::webViewContainingText("hello!"); 88 chrome_test_util::WebViewContainingText("hello!");
89 [[EarlGrey selectElementWithMatcher:webViewMatcher] 89 [[EarlGrey selectElementWithMatcher:webViewMatcher]
90 assertWithMatcher:grey_notNil()]; 90 assertWithMatcher:grey_notNil()];
91 91
92 // Opening the keyboard from a webview blocks EarlGrey's synchronization. 92 // Opening the keyboard from a webview blocks EarlGrey's synchronization.
93 [[GREYConfiguration sharedInstance] 93 [[GREYConfiguration sharedInstance]
94 setValue:@NO 94 setValue:@NO
95 forConfigKey:kGREYConfigKeySynchronizationEnabled]; 95 forConfigKey:kGREYConfigKeySynchronizationEnabled];
96 96
97 // Brings up the keyboard by tapping on one of the form's field. 97 // Brings up the keyboard by tapping on one of the form's field.
98 [[EarlGrey 98 [[EarlGrey
99 selectElementWithMatcher:web::webViewInWebState( 99 selectElementWithMatcher:web::WebViewInWebState(
100 chrome_test_util::GetCurrentWebState())] 100 chrome_test_util::GetCurrentWebState())]
101 performAction:web::webViewTapElement( 101 performAction:web::webViewTapElement(
102 chrome_test_util::GetCurrentWebState(), 102 chrome_test_util::GetCurrentWebState(),
103 kFormElementId1)]; 103 kFormElementId1)];
104 104
105 id<GREYMatcher> nextButtonMatcher = 105 id<GREYMatcher> nextButtonMatcher =
106 chrome_test_util::buttonWithAccessibilityLabelId( 106 chrome_test_util::ButtonWithAccessibilityLabelId(
107 IDS_IOS_AUTOFILL_ACCNAME_NEXT_FIELD); 107 IDS_IOS_AUTOFILL_ACCNAME_NEXT_FIELD);
108 id<GREYMatcher> previousButtonMatcher = 108 id<GREYMatcher> previousButtonMatcher =
109 chrome_test_util::buttonWithAccessibilityLabelId( 109 chrome_test_util::ButtonWithAccessibilityLabelId(
110 IDS_IOS_AUTOFILL_ACCNAME_PREVIOUS_FIELD); 110 IDS_IOS_AUTOFILL_ACCNAME_PREVIOUS_FIELD);
111 id<GREYMatcher> closeButtonMatcher = 111 id<GREYMatcher> closeButtonMatcher =
112 chrome_test_util::buttonWithAccessibilityLabelId( 112 chrome_test_util::ButtonWithAccessibilityLabelId(
113 IDS_IOS_AUTOFILL_ACCNAME_HIDE_KEYBOARD); 113 IDS_IOS_AUTOFILL_ACCNAME_HIDE_KEYBOARD);
114 114
115 // Wait until the keyboard's "Next" button appeared. 115 // Wait until the keyboard's "Next" button appeared.
116 NSString* description = @"Wait for the keyboard's \"Next\" button to appear."; 116 NSString* description = @"Wait for the keyboard's \"Next\" button to appear.";
117 ConditionBlock condition = ^{ 117 ConditionBlock condition = ^{
118 NSError* error = nil; 118 NSError* error = nil;
119 [[EarlGrey selectElementWithMatcher:nextButtonMatcher] 119 [[EarlGrey selectElementWithMatcher:nextButtonMatcher]
120 assertWithMatcher:grey_notNil() 120 assertWithMatcher:grey_notNil()
121 error:&error]; 121 error:&error];
122 return (error == nil); 122 return (error == nil);
(...skipping 29 matching lines...) Expand all
152 // visible doesn't crash the browser. 152 // visible doesn't crash the browser.
153 - (void)testCloseKeyboardWhenNotVisible { 153 - (void)testCloseKeyboardWhenNotVisible {
154 FormInputAccessoryViewController* inputAccessoryViewController = 154 FormInputAccessoryViewController* inputAccessoryViewController =
155 chrome_test_util::GetInputAccessoryViewController(); 155 chrome_test_util::GetInputAccessoryViewController();
156 GREYAssertNotNil(inputAccessoryViewController, 156 GREYAssertNotNil(inputAccessoryViewController,
157 @"The tab's input accessory view should not be non nil."); 157 @"The tab's input accessory view should not be non nil.");
158 [inputAccessoryViewController closeKeyboardWithoutButtonPress]; 158 [inputAccessoryViewController closeKeyboardWithoutButtonPress];
159 } 159 }
160 160
161 @end 161 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/context_menu/context_menu_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698