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

Side by Side Diff: ios/chrome/browser/ui/webui/web_ui_egtest.mm

Issue 2784943002: Remove matcher to wait for static HTML view. (Closed)
Patch Set: typo 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/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.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 11 matching lines...) Expand all
22 #include "ui/base/device_form_factor.h" 22 #include "ui/base/device_form_factor.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "url/scheme_host_port.h" 24 #include "url/scheme_host_port.h"
25 25
26 #if !defined(__has_feature) || !__has_feature(objc_arc) 26 #if !defined(__has_feature) || !__has_feature(objc_arc)
27 #error "This file requires ARC support." 27 #error "This file requires ARC support."
28 #endif 28 #endif
29 29
30 using chrome_test_util::BackButton; 30 using chrome_test_util::BackButton;
31 using chrome_test_util::ForwardButton; 31 using chrome_test_util::ForwardButton;
32 using chrome_test_util::StaticHtmlViewContainingText;
33 using chrome_test_util::TapWebViewElementWithId; 32 using chrome_test_util::TapWebViewElementWithId;
34 using chrome_test_util::WebViewContainingText; 33 using chrome_test_util::WebViewContainingText;
35 34
36 namespace { 35 namespace {
37 36
38 // Loads WebUI page with given |host|. 37 // Loads WebUI page with given |host|.
39 void LoadWebUIUrl(const std::string& host) { 38 void LoadWebUIUrl(const std::string& host) {
40 GURL web_ui_url(url::SchemeHostPort(kChromeUIScheme, host, 0).Serialize()); 39 GURL web_ui_url(url::SchemeHostPort(kChromeUIScheme, host, 0).Serialize());
41 [ChromeEarlGrey loadURL:web_ui_url]; 40 [ChromeEarlGrey loadURL:web_ui_url];
42 } 41 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 - (void)testChromeURLNavigateToNativePage { 114 - (void)testChromeURLNavigateToNativePage {
116 LoadWebUIUrl(kChromeUIChromeURLsHost); 115 LoadWebUIUrl(kChromeUIChromeURLsHost);
117 116
118 // Tap on chrome://terms link on the page. 117 // Tap on chrome://terms link on the page.
119 chrome_test_util::TapWebViewElementWithId(kChromeUITermsHost); 118 chrome_test_util::TapWebViewElementWithId(kChromeUITermsHost);
120 119
121 // Verify that the resulting page is chrome://terms. 120 // Verify that the resulting page is chrome://terms.
122 [[EarlGrey selectElementWithMatcher:WaitForOmniboxText("chrome://terms")] 121 [[EarlGrey selectElementWithMatcher:WaitForOmniboxText("chrome://terms")]
123 assertWithMatcher:grey_sufficientlyVisible()]; 122 assertWithMatcher:grey_sufficientlyVisible()];
124 NSString* kTermsText = @"Google Chrome Terms of Service"; 123 NSString* kTermsText = @"Google Chrome Terms of Service";
125 [[EarlGrey selectElementWithMatcher:StaticHtmlViewContainingText(kTermsText)] 124 [ChromeEarlGrey waitForStaticHTMLViewContainingText:kTermsText];
126 assertWithMatcher:grey_notNil()];
127 } 125 }
128 126
129 // Tests that back navigation functions properly after navigation via anchor 127 // Tests that back navigation functions properly after navigation via anchor
130 // click. 128 // click.
131 - (void)testChromeURLBackNavigationFromAnchorClick { 129 - (void)testChromeURLBackNavigationFromAnchorClick {
132 LoadWebUIUrl(kChromeUIChromeURLsHost); 130 LoadWebUIUrl(kChromeUIChromeURLsHost);
133 131
134 // Tap on chrome://version link on the page. 132 // Tap on chrome://version link on the page.
135 chrome_test_util::TapWebViewElementWithId(kChromeUIVersionHost); 133 chrome_test_util::TapWebViewElementWithId(kChromeUIVersionHost);
136 134
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 [[EarlGrey selectElementWithMatcher:WaitForOmniboxText(kChromeInvalidURL)] 211 [[EarlGrey selectElementWithMatcher:WaitForOmniboxText(kChromeInvalidURL)]
214 assertWithMatcher:grey_sufficientlyVisible()]; 212 assertWithMatcher:grey_sufficientlyVisible()];
215 NSString* kError = 213 NSString* kError =
216 l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); 214 l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE);
217 id<GREYMatcher> messageMatcher = [GREYMatchers matcherForText:kError]; 215 id<GREYMatcher> messageMatcher = [GREYMatchers matcherForText:kError];
218 [[EarlGrey selectElementWithMatcher:messageMatcher] 216 [[EarlGrey selectElementWithMatcher:messageMatcher]
219 assertWithMatcher:grey_notNil()]; 217 assertWithMatcher:grey_notNil()];
220 } 218 }
221 219
222 @end 220 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698