• Collin Baker's avatar
    Eagerly create tab_groups_ entries in FakeBaseTabStripController · 5cd14eef
    Collin Baker authored
    tab_groups_ maps tab model indices to group IDs. This was managed
    lazily: entries were created on grouping changes, not as tabs are
    added and removed. This is difficult to manage and led to a crash in a
    test I was writing.
    
    With this change the entries are created in AddTab() and
    AddPinnedTab(). tab_groups_.size() will always match num_tabs_.
    
    Several tests using TabStrip::AddTabAt() directly had to be migrated
    to use FakeBaseTabStripController::AddTab(). They relied on the lazy
    tab group management and the fact that |tab_groups_.size()| could be
    greater than |num_tabs_|.
    
    While I was in there, I migrated all tests to using
    FakeBaseTabStripController methods where possible.
    
    Bug: None
    Change-Id: I604fd1fca7f0349ad687210fae7ae35452ab1635
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518250Reviewed-by: default avatarTaylor Bergquist <tbergquist@chromium.org>
    Commit-Queue: Collin Baker <collinbaker@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#824228}
    5cd14eef
tab_strip_unittest.cc 49.7 KB