[ios] Fix eg tests that will be broken by thumbstrip
Unit tests are fixed in another CL.
Bug: 1293375
Change-Id: I97312e7c27cef19ae314319d6ef08d465b0a86ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3436411
Reviewed-by: Robbie Gibson <rkgibson@google.com>
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: David Jean <djean@chromium.org>
Cr-Commit-Position: refs/heads/main@{#972912}
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm b/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
index 9f147bbf..f6751fe 100644
--- a/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
+++ b/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
@@ -460,6 +460,12 @@
// Test that USER_DID_NOT_WAIT is reported if the user does not wait for the
// reload to be complete after eviction.
- (void)testEvictedTabSlowReload {
+ if ([ChromeEarlGrey isThumbstripEnabledForWindowWithNumber:0]) {
+ // Skip this test if thumbstrip is enabled. When enabled, the current tab
+ // is displayed at the bottom of the tab grid and not evicted.
+ EARL_GREY_TEST_SKIPPED(@"Thumbstrip keeps active tab alive.");
+ }
+
std::map<GURL, std::string> responses;
const GURL slowURL = web::test::HttpServer::MakeUrl("http://slow");
responses[slowURL] = "Slow Page";
@@ -516,6 +522,12 @@
// Test that the USER_DID_NOT_WAIT metric is logged when the user opens an NTP
// while the evicted tab is still reloading.
- (void)testEvictedTabReloadSwitchToNTP {
+ if ([ChromeEarlGrey isThumbstripEnabledForWindowWithNumber:0]) {
+ // Skip this test if thumbstrip is enabled. When enabled, the current tab
+ // is displayed at the bottom of the tab grid and not evicted.
+ EARL_GREY_TEST_SKIPPED(@"Thumbstrip keeps active tab alive.");
+ }
+
std::map<GURL, std::string> responses;
const GURL slowURL = web::test::HttpServer::MakeUrl("http://slow");
responses[slowURL] = "Slow Page";
@@ -622,6 +634,12 @@
// Tests that leaving Chrome while an evicted tab is reloading triggers the
// recording of the USER_LEFT_CHROME metric.
- (void)testEvictedTabReloadBackgrounded {
+ if ([ChromeEarlGrey isThumbstripEnabledForWindowWithNumber:0]) {
+ // Skip this test if thumbstrip is enabled. When enabled, the current tab
+ // is displayed at the bottom of the tab grid and not evicted.
+ EARL_GREY_TEST_SKIPPED(@"Thumbstrip keeps active tab alive.");
+ }
+
std::map<GURL, std::string> responses;
const GURL slowURL = web::test::HttpServer::MakeUrl("http://slow");
responses[slowURL] = "Slow Page";
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
index 20b3523..6bb64ce 100644
--- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -2806,6 +2806,7 @@
self.browserViewHiderCoordinator.panGestureHandler = nil;
self.view.transform = CGAffineTransformIdentity;
+ self.contentArea.alpha = 1;
if (!base::FeatureList::IsEnabled(kModernTabStrip)) {
self.tabStripSnapshot.transform =
[self.tabStripView adjustTransformForRTL:CGAffineTransformIdentity];
@@ -2964,6 +2965,7 @@
self.tabStripSnapshot.transform =
[self.tabStripView adjustTransformForRTL:CGAffineTransformIdentity];
self.tabStripSnapshot.alpha = 1;
+ self.contentArea.alpha = 1;
}
break;
case ViewRevealState::Peeked:
@@ -2974,6 +2976,7 @@
self.tabStripSnapshot.transform =
[self.tabStripView adjustTransformForRTL:transform];
self.tabStripSnapshot.alpha = 1;
+ self.contentArea.alpha = 1;
}
break;
case ViewRevealState::Revealed:
@@ -2985,6 +2988,8 @@
self.tabStripSnapshot.transform =
[self.tabStripView adjustTransformForRTL:transform];
self.tabStripSnapshot.alpha = 0;
+ self.contentArea.alpha =
+ nextViewRevealState == ViewRevealState::Revealed ? 1 : 0;
}
break;
}
diff --git a/ios/chrome/browser/ui/main/bvc_container_view_controller.h b/ios/chrome/browser/ui/main/bvc_container_view_controller.h
index 3b1fd3d..aae76ece 100644
--- a/ios/chrome/browser/ui/main/bvc_container_view_controller.h
+++ b/ios/chrome/browser/ui/main/bvc_container_view_controller.h
@@ -23,6 +23,12 @@
// be added as a child and have its view resized to this object's view's bounds.
@property(nonatomic, weak) UIViewController* currentBVC;
+// Fallback presenter VC to use when |currentBVC| is nil. Owner of this VC
+// should set this property, which is used by
+// |presentViewController:animated:completion:| and
+// |dismissViewControllerAnimated:completion:|.
+@property(nonatomic, weak) UIViewController* fallbackPresenterViewController;
+
// YES if the currentBVC is in incognito mode. Is used to set proper background
// color.
@property(nonatomic, assign) BOOL incognito;
diff --git a/ios/chrome/browser/ui/main/bvc_container_view_controller.mm b/ios/chrome/browser/ui/main/bvc_container_view_controller.mm
index 8f3c3279..a4cb4ad 100644
--- a/ios/chrome/browser/ui/main/bvc_container_view_controller.mm
+++ b/ios/chrome/browser/ui/main/bvc_container_view_controller.mm
@@ -82,20 +82,22 @@
- (void)presentViewController:(UIViewController*)viewControllerToPresent
animated:(BOOL)flag
completion:(void (^)())completion {
- // Force presentation to go through the current BVC, which does some
- // associated bookkeeping.
- DCHECK(self.currentBVC);
- [self.currentBVC presentViewController:viewControllerToPresent
- animated:flag
- completion:completion];
+ // Force presentation to go through the current BVC, if possible, which does
+ // some associated bookkeeping.
+ UIViewController* viewController =
+ self.currentBVC ? self.currentBVC : self.fallbackPresenterViewController;
+ [viewController presentViewController:viewControllerToPresent
+ animated:flag
+ completion:completion];
}
- (void)dismissViewControllerAnimated:(BOOL)flag
completion:(void (^)())completion {
- // Force dismissal to go through the current BVC, which does some associated
- // bookkeeping.
- DCHECK(self.currentBVC);
- [self.currentBVC dismissViewControllerAnimated:flag completion:completion];
+ // Force dismissal to go through the current BVC, if possible, which does some
+ // associated bookkeeping.
+ UIViewController* viewController =
+ self.currentBVC ? self.currentBVC : self.fallbackPresenterViewController;
+ [viewController dismissViewControllerAnimated:flag completion:completion];
}
- (UIViewController*)childViewControllerForStatusBarHidden {
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm
index 3ce0a586..09a1c687 100644
--- a/ios/chrome/browser/ui/main/scene_controller.mm
+++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -2713,8 +2713,8 @@
dismissSettings();
}
} else if (self.signinCoordinator) {
- // |self.signinCoordinator| can be presented without settings, from the
- // bookmarks or the recent tabs view.
+ // |self.signinCoordinator| can be presented without settings, from the
+ // bookmarks or the recent tabs view.
[self interruptSigninCoordinatorAnimated:animated completion:completion];
} else {
completion();
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/grid_cell.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/grid_cell.mm
index e11625a..7192b4b 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/grid_cell.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/grid_cell.mm
@@ -212,6 +212,7 @@
self.selected = NO;
self.priceCardView.hidden = YES;
self.opacity = 1.0;
+ [self hideActivityIndicator];
}
#pragma mark - UIAccessibility
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/plus_sign_cell.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/plus_sign_cell.mm
index 01f7869..b99f794 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/plus_sign_cell.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/grid/plus_sign_cell.mm
@@ -35,6 +35,7 @@
AddSameCenterConstraints(plusSignView, self.contentView);
+ self.accessibilityTraits |= UIAccessibilityTraitButton;
self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
}
return self;
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator.mm
index 7727e14..256b3ae 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator.mm
@@ -444,6 +444,9 @@
self.bvcContainer = [[BVCContainerViewController alloc] init];
self.bvcContainer.currentBVC = viewController;
self.bvcContainer.incognito = incognito;
+ // Set fallback presenter, because currentBVC can be nil if the tab grid is
+ // up but no tabs exist in current page.
+ self.bvcContainer.fallbackPresenterViewController = self.baseViewController;
BOOL animated = !self.animationsDisabledForTesting;
// Never animate the first time.
@@ -539,8 +542,10 @@
// Create a BVC add it to this view controller if not present. The thumb strip
// always needs a BVC container on screen.
- self.bvcContainer =
- self.bvcContainer ?: [[BVCContainerViewController alloc] init];
+ if (!self.bvcContainer) {
+ self.bvcContainer = [[BVCContainerViewController alloc] init];
+ self.bvcContainer.fallbackPresenterViewController = self.baseViewController;
+ }
if (!self.bvcContainer.view.superview) {
[self.baseViewController addChildViewController:self.bvcContainer];
self.bvcContainer.view.frame = self.baseViewController.view.bounds;
@@ -789,8 +794,8 @@
focusOmnibox:(BOOL)focusOmnibox
closeTabGrid:(BOOL)closeTabGrid {
DCHECK(self.regularBrowser && self.incognitoBrowser);
- DCHECK(closeTabGrid || ShowThumbStripInTraitCollection(
- self.baseViewController.traitCollection));
+ DCHECK(closeTabGrid || [self isThumbStripEnabled]);
+
Browser* activeBrowser = nullptr;
switch (page) {
case TabGridPageIncognitoTabs:
@@ -1101,6 +1106,11 @@
- (void)viewController:(UIViewController*)viewController
traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
+ SceneState* sceneState =
+ SceneStateBrowserAgent::FromBrowser(self.regularBrowser)->GetSceneState();
+ if (sceneState.activationLevel < SceneActivationLevelForegroundInactive) {
+ return;
+ }
BOOL canShowThumbStrip =
ShowThumbStripInTraitCollection(viewController.traitCollection);
if (canShowThumbStrip != [self isThumbStripEnabled]) {
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm
index 7228367..4970926 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm
@@ -83,6 +83,24 @@
grey_sufficientlyVisible(), nil);
}
+void WaitForTabGridFullscreen() {
+ if (![ChromeEarlGrey isThumbstripEnabledForWindowWithNumber:0]) {
+ return;
+ }
+
+ // Check that the bvc hider is visible.
+ ConditionBlock condition = ^{
+ NSError* error = nil;
+ [[EarlGrey
+ selectElementWithMatcher:grey_accessibilityID(@"BrowserViewHiderView")]
+ assertWithMatcher:grey_not(grey_sufficientlyVisible())
+ error:&error];
+ return error == nil;
+ };
+ bool fullscreenAchieved = base::test::ios::WaitUntilConditionOrTimeout(
+ base::test::ios::kWaitForUIElementTimeout, condition);
+ GREYAssertTrue(fullscreenAchieved, @"BrowserViewHiderView still shown");
+}
} // namespace
@interface TabGridTestCase : WebHttpServerChromeTestCase {
@@ -862,6 +880,7 @@
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridSelectTabsMenuButton()]
performAction:grey_tap()];
+ WaitForTabGridFullscreen();
// Tap tab to select.
[[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridCellAtIndex(0)]
@@ -917,6 +936,7 @@
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridSelectTabsMenuButton()]
performAction:grey_tap()];
+ WaitForTabGridFullscreen();
// Tap "Select all" and close selected tabs.
[[EarlGrey
@@ -964,6 +984,7 @@
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridSelectTabsMenuButton()]
performAction:grey_tap()];
+ WaitForTabGridFullscreen();
// Ensure button label is "Select All" and select all items.
[[EarlGrey selectElementWithMatcher:SelectAllButton()]
@@ -1023,6 +1044,7 @@
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridSelectTabsMenuButton()]
performAction:grey_tap()];
+ WaitForTabGridFullscreen();
// Select the first and last items.
[[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridCellAtIndex(0)]
@@ -1078,6 +1100,7 @@
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridSelectTabsMenuButton()]
performAction:grey_tap()];
+ WaitForTabGridFullscreen();
// Select the first and last items.
[[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridCellAtIndex(0)]
@@ -1123,6 +1146,7 @@
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridSelectTabsMenuButton()]
performAction:grey_tap()];
+ WaitForTabGridFullscreen();
// Select the first and last items.
[[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridCellAtIndex(0)]
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm
index e1af947..528b632 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm
@@ -285,16 +285,6 @@
else
_leadingButton = _closeAllOrUndoButton;
- if (ShowThumbStripInTraitCollection(traitCollection)) {
- // The new tab button is only used if the thumb strip is enabled. In other
- // cases, there is a floating new tab button on the bottom.
- [self setItems:@[
- _leadingButton, _spaceItem, centralItem, _spaceItem, _newTabButton,
- _iconButtonAdditionalSpaceItem, trailingButton
- ]];
- return;
- }
-
if (_mode == TabGridModeSelection) {
// In the selection mode, Done button is much smaller than SelectAll
// we need to calculate the difference on the width and use it as a
@@ -304,6 +294,9 @@
_leadingButton = _selectAllButton;
}
+ // Build item list based on priority: tab search takes precedence over thumb
+ // strip.
+
if (IsTabsSearchEnabled() && _mode == TabGridModeNormal) {
[self setItems:@[
_leadingButton, _iconButtonAdditionalSpaceItem, _searchButton, _spaceItem,
@@ -312,6 +305,16 @@
return;
}
+ if (ShowThumbStripInTraitCollection(traitCollection)) {
+ // The new tab button is only used if the thumb strip is enabled. In other
+ // cases, there is a floating new tab button on the bottom.
+ [self setItems:@[
+ _leadingButton, _spaceItem, centralItem, _spaceItem, _newTabButton,
+ _iconButtonAdditionalSpaceItem, trailingButton
+ ]];
+ return;
+ }
+
[self setItems:@[
_leadingButton, _spaceItem, centralItem, _spaceItem,
_selectionModeFixedSpace, trailingButton
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_transition_egtest.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_transition_egtest.mm
index e8ae39b..fa7a5ad 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_transition_egtest.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_transition_egtest.mm
@@ -42,6 +42,8 @@
void SelectTab(NSString* title) {
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(title),
+ grey_ancestor(grey_kindOfClassName(
+ @"GridCell")),
grey_accessibilityTrait(
UIAccessibilityTraitStaticText),
nil)] performAction:grey_tap()];
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_view_controller.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_view_controller.mm
index 16627c6..813dae5 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_view_controller.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_view_controller.mm
@@ -1534,14 +1534,17 @@
if (self.thumbStripEnabled) {
GridViewController* gridViewController =
[self gridViewControllerForPage:self.currentPage];
- DCHECK(gridViewController);
- if (gridViewController.fractionVisibleOfLastItem >= 0.999) {
- // Don't show the bottom new tab button because the plus sign cell is
- // visible.
- return;
+ // gridViewController can be null if page configuration disables the
+ // currentPage mode.
+ if (gridViewController) {
+ if (gridViewController.fractionVisibleOfLastItem >= 0.999) {
+ // Don't show the bottom new tab button because the plus sign cell is
+ // visible.
+ return;
+ }
+ self.plusSignButton.alpha =
+ 1 - gridViewController.fractionVisibleOfLastItem;
}
- self.plusSignButton.alpha =
- 1 - gridViewController.fractionVisibleOfLastItem;
}
[self.bottomToolbar show];
}
diff --git a/ios/chrome/test/earl_grey/BUILD.gn b/ios/chrome/test/earl_grey/BUILD.gn
index d5a58cb2..b18d33d7 100644
--- a/ios/chrome/test/earl_grey/BUILD.gn
+++ b/ios/chrome/test/earl_grey/BUILD.gn
@@ -151,8 +151,10 @@
"//ios/chrome/browser/ui/settings/sync",
"//ios/chrome/browser/ui/tab_switcher/tab_grid:features",
"//ios/chrome/browser/ui/tab_switcher/tab_grid:tab_grid_ui_constants",
+ "//ios/chrome/browser/ui/tab_switcher/tab_grid/grid:grid_ui",
"//ios/chrome/browser/ui/tab_switcher/tab_grid/grid:grid_ui_constants",
"//ios/chrome/browser/ui/table_view/cells",
+ "//ios/chrome/browser/ui/thumb_strip:feature_flags",
"//ios/chrome/browser/ui/toolbar:eg_app_support+eg2",
"//ios/chrome/browser/ui/toolbar:toolbar_ui",
"//ios/chrome/browser/ui/toolbar/public",
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.h b/ios/chrome/test/earl_grey/chrome_earl_grey.h
index fb5a4f6..dfc9926 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey.h
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey.h
@@ -655,6 +655,10 @@
// Returns whether the NewOverflowMenu feature is enabled.
- (BOOL)isNewOverflowMenuEnabled;
+// Returns whether the Thumbstrip feature is enabled for window with given
+// number.
+- (BOOL)isThumbstripEnabledForWindowWithNumber:(int)windowNumber;
+
#pragma mark - ContentSettings
// Gets the current value of the popup content setting preference for the
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.mm b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
index 048eea83..79dec42 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -1245,6 +1245,11 @@
return [ChromeEarlGreyAppInterface isNewOverflowMenuEnabled];
}
+- (BOOL)isThumbstripEnabledForWindowWithNumber:(int)windowNumber {
+ return [ChromeEarlGreyAppInterface
+ isThumbstripEnabledForWindowWithNumber:windowNumber];
+}
+
#pragma mark - ContentSettings
- (ContentSetting)popupPrefValue {
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h
index 4532de7..31aa558 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h
@@ -536,6 +536,10 @@
// Returns whether the NewOverflowMenu feature is enabled.
+ (BOOL)isNewOverflowMenuEnabled;
+// Returns whether the Thumbstrip feature is enabled for window with given
+// number.
++ (BOOL)isThumbstripEnabledForWindowWithNumber:(int)windowNumber;
+
#pragma mark - ContentSettings
// Gets the current value of the popup content setting preference for the
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm
index 246afad..acff91f 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm
@@ -32,6 +32,7 @@
#import "ios/chrome/browser/ui/default_promo/default_browser_utils.h"
#import "ios/chrome/browser/ui/main/scene_state.h"
#import "ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h"
+#import "ios/chrome/browser/ui/thumb_strip/thumb_strip_feature.h"
#import "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/browser/ui/util/named_guide.h"
#import "ios/chrome/browser/ui/util/rtl_geometry.h"
@@ -361,6 +362,20 @@
#pragma mark - Window utilities (EG2)
++ (UIWindow*)windowWithNumber:(int)windowNumber {
+ NSArray<SceneState*>* connectedScenes =
+ chrome_test_util::GetMainController().appState.connectedScenes;
+ NSString* accessibilityIdentifier =
+ [NSString stringWithFormat:@"%ld", (long)windowNumber];
+ for (SceneState* state in connectedScenes) {
+ if ([state.window.accessibilityIdentifier
+ isEqualToString:accessibilityIdentifier]) {
+ return state.window;
+ }
+ }
+ return nil;
+}
+
// Returns screen position of the given |windowNumber|
+ (CGRect)screenPositionOfScreenWithNumber:(int)windowNumber {
NSArray<SceneState*>* connectedScenes =
@@ -1098,6 +1113,11 @@
return IsNewOverflowMenuEnabled();
}
++ (BOOL)isThumbstripEnabledForWindowWithNumber:(int)windowNumber {
+ return ShowThumbStripInTraitCollection(
+ [self windowWithNumber:windowNumber].traitCollection);
+}
+
#pragma mark - ContentSettings
+ (ContentSetting)popupPrefValue {
diff --git a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm
index 42f2b63..fddc865 100644
--- a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm
+++ b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm
@@ -47,6 +47,7 @@
#import "ios/chrome/browser/ui/settings/settings_root_table_constants.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller_constants.h"
#import "ios/chrome/browser/ui/tab_switcher/tab_grid/grid/grid_constants.h"
+#import "ios/chrome/browser/ui/tab_switcher/tab_grid/grid/plus_sign_cell.h"
#import "ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_switch_cell.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_switch_item.h"
@@ -309,7 +310,10 @@
}
+ (id<GREYMatcher>)defocusedLocationView {
- return grey_kindOfClass([LocationBarSteadyView class]);
+ return grey_allOf(
+ grey_kindOfClass([LocationBarSteadyView class]),
+ grey_not(grey_ancestor(grey_accessibilityID(@"BrowserViewHiderView"))),
+ nil);
}
+ (id<GREYMatcher>)pageSecurityInfoButton {
@@ -317,7 +321,9 @@
}
+ (id<GREYMatcher>)pageSecurityInfoIndicator {
- return grey_accessibilityLabel(@"Page Security Info");
+ return grey_allOf(grey_accessibilityLabel(@"Page Security Info"),
+ grey_ancestor(grey_kindOfClass([PrimaryToolbarView class])),
+ nil);
}
+ (id<GREYMatcher>)omniboxText:(NSString*)text {
@@ -869,6 +875,7 @@
+ (id<GREYMatcher>)tabGridCellAtIndex:(unsigned int)index {
return grey_allOf(grey_accessibilityID(IdentifierForCellAtIndex(index)),
+ grey_not(grey_kindOfClass([PlusSignCell class])),
grey_sufficientlyVisible(), nil);
}