• tapted's avatar
    For Mac, add AppListViewDelegateObserver::OnShutdown; deflake tests · a40c605b
    tapted authored
    We used to just leak everything on Mac. Since r295194, we clean up
    references to Profiles being deleted, in Chrome's AppListViewDelegate.
    This has caught out the Mac app list trying to access stuff it shouldn't
    if Cocoa is still drawing it while Chrome is shutting down. Tests
    started failing flakily.
    
    This CL adds AppListViewDelegateObserver::OnShutdown to that Chrome's
    AppListViewDelegate can notify the AppListView that it's shutting down.
    
    On Views platforms, the Widget is just closed (which also happens just
    after the chrome::NOTIFICATION_APP_TERMINATING broadcast). However, (a)
    Cocoa doesn't have a `CloseAllSecondaryWidgets` call to trigger this and
    (b) just closing the NSWindow isn't usually enough on Cocoa to avoid
    accessing C++ objects due to reference counting.
    
    We could also go through the platform-specific AppListService (e.g. by
    passing in the AppListService that creates a Chrome
    AppListViewDelegate), but this seemed neater.
    
    This de-flakes a bunch of applist tests on Mac. The Mac-specific
    ShowAppListUsingShim test is also augmented with extra checks for the
    OnShutdown stuff.
    
    BUG=415264
    TEST=AppListServiceMacInteractiveTest.ShowAppListUsingShim,
    AppListServiceInteractiveTest.*
    
    Review URL: https://codereview.chromium.org/593563002
    
    Cr-Commit-Position: refs/heads/master@{#296363}
    a40c605b
app_list_model.h 7.46 KB