• mgiuca's avatar
    AppListModel / AppsGridView: Better error handling for corner cases. · aebcdf88
    mgiuca authored
    Fixes a potential crash if an app gets duplicated in the app list, and
    the user tries to drop it onto itself. (There is no known way to repro
    this currently, but there was recently; see http://crbug.com/415530.)
    That situation will now result in a very descriptive DCHECK, rather than
    a confusing low-level CHECK fail.
    
    AppListModel::MergeItems:
    - returns "" instead of crashing if the source and target IDs are equal.
    - returns "" instead of crashing if the target ID is inside a folder (no
      longer needs to explicitly CHECK whether it is in a folder.)
    
    Added plenty of new tests for the various corner cases in
    AppListModel::MergeItems which would have caught these crashes.
    
    AppsGridView::MoveItemToFolder:
    - DCHECKs for a NULL result of GetViewAtSlotOnCurrentPage.
    - DCHECKs that you aren't dropping an item onto itself (this should
      never happen).
    
    BUG=417482
    
    Review URL: https://codereview.chromium.org/600393002
    
    Cr-Commit-Position: refs/heads/master@{#297356}
    aebcdf88
app_list_model.cc 14.4 KB