| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
public static boolean checkTabsPinnedStatus(If you inline this, you can have better status messages and not have to rely on a single boolean.
```
@Override
public ConditionStatus checkWithSuppliers() {
for (@TabId Integer tabId : tabIdsToCheck) {
Tab tab = tabModel.getTabById(tabId);
if (tab == null) continue;
boolean isTabPinned = tab.getIsPinned();
if (isTabPinned != shouldBePinned) {
return notFulfilled("Tab %s has isPinned=%b, expected isPinned=%b", tabId, isTabPinned, shouldBePinned);
}
}
return fulfilled("All tabs match expected pinned state");
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
public static boolean checkTabsPinnedStatus(If you inline this, you can have better status messages and not have to rely on a single boolean.
```
@Override
public ConditionStatus checkWithSuppliers() {
for (@TabId Integer tabId : tabIdsToCheck) {
Tab tab = tabModel.getTabById(tabId);
if (tab == null) continue;
boolean isTabPinned = tab.getIsPinned();
if (isTabPinned != shouldBePinned) {
return notFulfilled("Tab %s has isPinned=%b, expected isPinned=%b", tabId, isTabPinned, shouldBePinned);
}
}
return fulfilled("All tabs match expected pinned state");
}```
Also, not sure if you intended for tab == null to skip that tab, I think it should result in notFulfilled(), right?
private void changePinnedState(boolean currentlyPinned) {Kind of weird for the param to be the current value, I'd probably use `newPinnedState`
boolean matchesPinnedStatus =
ThreadUtils.runOnUiThreadBlocking(
() ->
checkTabsPinnedStatus(
mHostStation.getTabModel(),
List.of(mTabId),
currentlyPinned));
assertTrue(matchesPinnedStatus);```
noopTo().waitFor(new TabsPinnedStatusCondition(
mHostStation.getTabModel(), List.of(mTabId), currentlyPinned))
```
mHostStation.getTabModel(), List.of(mTabId), currentlyPinned));should be !currentlyPinned or newPinnedState.
}Per last CL also move to ContextMenu test file.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Per last CL also move to ContextMenu test file.
Done
private void changePinnedState(boolean currentlyPinned) {Kind of weird for the param to be the current value, I'd probably use `newPinnedState`
Done
boolean matchesPinnedStatus =
ThreadUtils.runOnUiThreadBlocking(
() ->
checkTabsPinnedStatus(
mHostStation.getTabModel(),
List.of(mTabId),
currentlyPinned));
assertTrue(matchesPinnedStatus);```
noopTo().waitFor(new TabsPinnedStatusCondition(
mHostStation.getTabModel(), List.of(mTabId), currentlyPinned))
```
Nice! Didn't know this was possible!
mHostStation.getTabModel(), List.of(mTabId), currentlyPinned));should be !currentlyPinned or newPinnedState.
Done
Henrique NakashimaIf you inline this, you can have better status messages and not have to rely on a single boolean.
```
@Override
public ConditionStatus checkWithSuppliers() {
for (@TabId Integer tabId : tabIdsToCheck) {
Tab tab = tabModel.getTabById(tabId);
if (tab == null) continue;
boolean isTabPinned = tab.getIsPinned();
if (isTabPinned != shouldBePinned) {
return notFulfilled("Tab %s has isPinned=%b, expected isPinned=%b", tabId, isTabPinned, shouldBePinned);
}
}
return fulfilled("All tabs match expected pinned state");
}```
Also, not sure if you intended for tab == null to skip that tab, I think it should result in notFulfilled(), right?
Thanks for catching that! Glad to finally get rid of that method.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
RegularNewTabPageStation ntp = tabSwitcher.openNewTab();nit: Add a TODO(crbug.com/468013785): Remove when BlankCTATabInitialStateRule can reset state from the Tab Switcher.
return "Tabs should all be " + (mShouldBePinned ? "pinned" : "unpinned");nit: "%d tabs should all be"
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
RegularNewTabPageStation ntp = tabSwitcher.openNewTab();nit: Add a TODO(crbug.com/468013785): Remove when BlankCTATabInitialStateRule can reset state from the Tab Switcher.
Done
ntp = tabSwitcher.openNewTab();Fiaz Muhammadditto
Done
return "Tabs should all be " + (mShouldBePinned ? "pinned" : "unpinned");nit: "%d tabs should all be"
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
return scrollToItemTo().withPossiblyAlreadyFulfilled().enterFacility(focusedItem);This shouldn't be needed because we've just checked that viewMatches.size() == 0. If this is to create checkAbsent, I think it's better to have a separate code path.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
return scrollToItemTo().withPossiblyAlreadyFulfilled().enterFacility(focusedItem);This shouldn't be needed because we've just checked that viewMatches.size() == 0. If this is to create checkAbsent, I think it's better to have a separate code path.
I did this, since the test seems to pass the `viewMatches.size() == 0` check, following which PT proceeds to inform me that the item is already visible.
I'm willing to guess that it's since the ScrollableFacility viewMatches.size() check also checks for isCompletelyDisplayed() (100% visibility), while scrollToItemTo only requires 90%> visibility. I checked the logs, and we're at 91%.
I modified the ItemFacility to relax the 100% visibility requirement to 90%> to ensure that items are fully displayed before moving on. Alternatively, I can update ScrollableFacility.Item to require 100% visibility or just go with my earlier fix.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
return scrollToItemTo().withPossiblyAlreadyFulfilled().enterFacility(focusedItem);Fiaz MuhammadThis shouldn't be needed because we've just checked that viewMatches.size() == 0. If this is to create checkAbsent, I think it's better to have a separate code path.
I did this, since the test seems to pass the `viewMatches.size() == 0` check, following which PT proceeds to inform me that the item is already visible.
I'm willing to guess that it's since the ScrollableFacility viewMatches.size() check also checks for isCompletelyDisplayed() (100% visibility), while scrollToItemTo only requires 90%> visibility. I checked the logs, and we're at 91%.
I modified the ItemFacility to relax the 100% visibility requirement to 90%> to ensure that items are fully displayed before moving on. Alternatively, I can update ScrollableFacility.Item to require 100% visibility or just go with my earlier fix.
You're right, let's just do withPossiblyAlreadyFulfilled() here (and add a comment). Thanks for the explanation!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
22 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
[Public Transit] Pin tab functionality and tests
- Add methods to click the "Pin tab" menu entry and account for
its variants.
- Add a condition to check tabs pinned status.
- Add tests.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |