OLD | NEW |
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // user agent string. | 84 // user agent string. |
85 - (void)testVersion { | 85 - (void)testVersion { |
86 LoadWebUIUrl(kChromeUIVersionHost); | 86 LoadWebUIUrl(kChromeUIVersionHost); |
87 | 87 |
88 // Verify that app version is present on the page. | 88 // Verify that app version is present on the page. |
89 const std::string version = version_info::GetVersionNumber(); | 89 const std::string version = version_info::GetVersionNumber(); |
90 [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)] | 90 [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)] |
91 assertWithMatcher:grey_notNil()]; | 91 assertWithMatcher:grey_notNil()]; |
92 | 92 |
93 // Verify that mobile User Agent string is present on the page. | 93 // Verify that mobile User Agent string is present on the page. |
94 const bool isDesktopUA = false; | 94 const std::string userAgent = |
95 const std::string userAgent = web::GetWebClient()->GetUserAgent(isDesktopUA); | 95 web::GetWebClient()->GetUserAgent(web::UserAgentType::MOBILE); |
96 [[EarlGrey selectElementWithMatcher:WebViewContainingText(userAgent)] | 96 [[EarlGrey selectElementWithMatcher:WebViewContainingText(userAgent)] |
97 assertWithMatcher:grey_notNil()]; | 97 assertWithMatcher:grey_notNil()]; |
98 } | 98 } |
99 | 99 |
100 // Tests that chrome://physical-web renders and the page title is present. | 100 // Tests that chrome://physical-web renders and the page title is present. |
101 - (void)testPhysicalWeb { | 101 - (void)testPhysicalWeb { |
102 // Enable the Physical Web via Chrome variation. | 102 // Enable the Physical Web via Chrome variation. |
103 base::FieldTrialList::CreateFieldTrial("PhysicalWebEnabled", "Enabled"); | 103 base::FieldTrialList::CreateFieldTrial("PhysicalWebEnabled", "Enabled"); |
104 | 104 |
105 LoadWebUIUrl(kChromeUIPhysicalWebHost); | 105 LoadWebUIUrl(kChromeUIPhysicalWebHost); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 [[EarlGrey selectElementWithMatcher:WaitForOmniboxText(kChromeInvalidURL)] | 213 [[EarlGrey selectElementWithMatcher:WaitForOmniboxText(kChromeInvalidURL)] |
214 assertWithMatcher:grey_sufficientlyVisible()]; | 214 assertWithMatcher:grey_sufficientlyVisible()]; |
215 NSString* kError = | 215 NSString* kError = |
216 l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); | 216 l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); |
217 id<GREYMatcher> messageMatcher = [GREYMatchers matcherForText:kError]; | 217 id<GREYMatcher> messageMatcher = [GREYMatchers matcherForText:kError]; |
218 [[EarlGrey selectElementWithMatcher:messageMatcher] | 218 [[EarlGrey selectElementWithMatcher:messageMatcher] |
219 assertWithMatcher:grey_notNil()]; | 219 assertWithMatcher:grey_notNil()]; |
220 } | 220 } |
221 | 221 |
222 @end | 222 @end |
OLD | NEW |