New issue
Advanced search Search tips

Issue 882723 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Bug



Sign in to add a comment

[iOS] Investigate AdaptiveToolbarTestCase.testToolbarUI trait collection issue.

Project Member Reported by kkhorimoto@chromium.org, Sep 11

Issue description

When fixing the secondary toolbar animations in crrev.com/c/1208713, we encountered test failures in the CQ for AdaptiveToolbarTestCase.testToolbarUI.  When debugging, it seems that this is because that test uses UIViewController's |-setsetOverrideTraitCollection:forChildViewController:|.  It appears that when the trait collection is overridden, the view controller's view's trait collection is updated at a later point in the runloop that isn't triggered by |-setNeedsLayout| + |-layoutIfNeeded|.  Thus when we call |-layoutIfNeeded| to trigger the animation, at that point, the SecondaryToolbarViewController has received its |-traitCollectionDidChange:| message, but the toolbar's subviews trait collections haven't been updated yet.  The toolbar buttons' visibility is calculated based on the button's trait collection, and since the layout occurs before the subviews' trait collections have been updated, they hide themselves.  This was fixed in crrev.com/c/1208713 by updating the button visibility from |-viewDidLayoutSubviews|, but this is a sub-optimal solution because this is performing excess work for layout events unrelated to trait collection changes.  We should find a way to test trait collection variations on the adaptive toolbar where the animations work and we avoid this extra effort.


Example failure:
https://ci.chromium.org/p/chromium/builders/luci.chromium.try/ios-simulator-full-configs/4923
 

Sign in to add a comment