| 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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 | 7 |
| 8 #include "components/strings/grit/components_strings.h" | 8 #include "components/strings/grit/components_strings.h" |
| 9 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 9 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 assertWithMatcher:grey_notVisible()]; | 281 assertWithMatcher:grey_notVisible()]; |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 // Tests that the NTP's toolbar is not visible when the NTP is scrolled up. | 285 // Tests that the NTP's toolbar is not visible when the NTP is scrolled up. |
| 286 - (void)testScrollToolbar { | 286 - (void)testScrollToolbar { |
| 287 if (IsIPadIdiom()) { | 287 if (IsIPadIdiom()) { |
| 288 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no hidden toolbar in tablet)"); | 288 EARL_GREY_TEST_SKIPPED(@"Skipped for iPad (no hidden toolbar in tablet)"); |
| 289 } | 289 } |
| 290 | 290 |
| 291 NSString* tabSwitcherLabel = | |
| 292 l10n_util::GetNSString(IDS_IOS_TOOLBAR_SHOW_TABS); | |
| 293 NSString* toolsMenuLabel = l10n_util::GetNSString(IDS_IOS_TOOLBAR_SETTINGS); | 291 NSString* toolsMenuLabel = l10n_util::GetNSString(IDS_IOS_TOOLBAR_SETTINGS); |
| 294 | 292 |
| 295 // Check that the toolbar's tab switcher and tools menu buttons are visible. | 293 // Check that the toolbar's tab switcher and tools menu buttons are visible. |
| 296 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(tabSwitcherLabel)] | 294 [[EarlGrey selectElementWithMatcher:chrome_test_util::ShowTabsButton()] |
| 297 assertWithMatcher:grey_sufficientlyVisible()]; | 295 assertWithMatcher:grey_sufficientlyVisible()]; |
| 298 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] | 296 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] |
| 299 assertWithMatcher:grey_sufficientlyVisible()]; | 297 assertWithMatcher:grey_sufficientlyVisible()]; |
| 300 AssertNTPScrolledToTop(NO); | 298 AssertNTPScrolledToTop(NO); |
| 301 | 299 |
| 302 // Swipe up the NTP. The omnibox should be fixed at the top of the screen. | 300 // Swipe up the NTP. The omnibox should be fixed at the top of the screen. |
| 303 id<GREYMatcher> matcher = grey_accessibilityID(@"Google Landing"); | 301 id<GREYMatcher> matcher = grey_accessibilityID(@"Google Landing"); |
| 304 [[EarlGrey selectElementWithMatcher:matcher] | 302 [[EarlGrey selectElementWithMatcher:matcher] |
| 305 performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; | 303 performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; |
| 306 AssertNTPScrolledToTop(YES); | 304 AssertNTPScrolledToTop(YES); |
| 307 | 305 |
| 308 // Check that tab switcher and tools menu buttons are not on screen. | 306 // Check that tab switcher and tools menu buttons are not on screen. |
| 309 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(tabSwitcherLabel)] | 307 [[EarlGrey selectElementWithMatcher:chrome_test_util::ShowTabsButton()] |
| 310 assertWithMatcher:grey_notVisible()]; | 308 assertWithMatcher:grey_notVisible()]; |
| 311 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] | 309 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] |
| 312 assertWithMatcher:grey_notVisible()]; | 310 assertWithMatcher:grey_notVisible()]; |
| 313 } | 311 } |
| 314 | 312 |
| 315 @end | 313 @end |
| OLD | NEW |