Commit d7dc4dcf authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

Revert "[ios] Fix test ReplaceScrolledOffScreenCell"

This reverts commit bb4205e3.

Reason for revert: this test still fails. example: https://ci.chromium.org/p/chrome/builders/ci/ipad-device/13104

Original change's description:
> [ios] Fix test ReplaceScrolledOffScreenCell
>
> Re-enables disabled test ReplaceScrolledOffScreenCell.
> Uses hardcoded number of items in test instead of flakey
> dynamic approach.
>
> Bug: 1104872
> Change-Id: Ic7ca34b7fa8936452fbc6efaee12563803eb023e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450812
> Reviewed-by: Mark Cogan <marq@chromium.org>
> Commit-Queue: edchin <edchin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#814776}

TBR=marq@chromium.org,edchin@chromium.org

Change-Id: I01adfe29516ad5d31642892331f573c96246b1dd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1104872
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461110Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815101}
parent 0fc83cb3
......@@ -183,7 +183,14 @@ TEST_F(GridViewControllerTest, MoveUnselectedItem) {
// Tests that |-replaceItemID:withItem:| does not crash when updating an item
// that is scrolled offscreen.
TEST_F(GridViewControllerTest, ReplaceScrolledOffScreenCell) {
TEST_F(GridViewControllerTest, DISABLED_ReplaceScrolledOffScreenCell) {
// TODO(crbug.com/1104872): On iOS 14 iPhone X, visibleCellsCount is always
// equal to the total number of cells, so the while loop below never
// terminates.
if (@available(iOS 14, *)) {
return;
}
// This test requires that the collection view be placed on the screen.
SetRootViewController(view_controller_);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
......@@ -191,16 +198,17 @@ TEST_F(GridViewControllerTest, ReplaceScrolledOffScreenCell) {
return view_controller_.collectionView.visibleCells.count > 0;
}));
NSArray* items = view_controller_.items;
// Keep adding items until we get an item that is offscreen.
// TODO(crbug.com/1104872): Since device sizes may vary, it would be better to
// not use a fixed number of items. But that approach (using the count of
// visibleCells) was flakey. 30 items should be plenty to produce offscreen
// items even on and iPad.
while (items.count <= 30) {
// Keep adding items until we get an item that is offscreen. Since device
// sizes may vary, this is better than creating a fixed number of items that
// we think will overflow to offscreen items.
NSUInteger visibleCellsCount =
view_controller_.collectionView.visibleCells.count;
while (visibleCellsCount >= items.count) {
NSString* uniqueID =
[NSString stringWithFormat:@"%d", base::checked_cast<int>(items.count)];
GridItem* item = [[GridItem alloc] initWithIdentifier:uniqueID];
[view_controller_ insertItem:item atIndex:0 selectedItemID:@"A"];
visibleCellsCount = view_controller_.collectionView.visibleCells.count;
}
// The last item ("B") is scrolled off screen.
GridItem* item = [[GridItem alloc] initWithIdentifier:@"NEW-ITEM"];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment