app_list: Fix possible out of bounds index.
commit86f30b9ad7616f56c52557b50c5057ed2d1f3273
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Wed, 28 May 2014 05:27:09 +0000 (28 05:27 +0000)
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Wed, 28 May 2014 05:27:09 +0000 (28 05:27 +0000)
tree05a7088e45397c6aae201bcd2a6f0f5d52a1e62a
parent33e2bc2bf3a3429eea5ab366337f4c97ef8f85fb
app_list: Fix possible out of bounds index.

- Fix a problem that could not drop at the last position when dragging
  an item out of a folder;
- Fix a case view_model_.Move is called with an out of range target index
  when dragging the last item out of folder;
- Add a test for dragging last item and drop it at last slot;
- Speculative fix to protect using an index from data model to modify
   view_model_;
- A few more DCHECKs to catch the out-of-bound case;

BUG=370064
TEST=AppListMainViewTest.DragLastItemFromFolderAndDropAtLastSlot

Review URL: https://codereview.chromium.org/298963004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273151 0039d316-1c4b-4281-b951-d872f2087c98
ui/app_list/cocoa/apps_grid_controller_unittest.mm
ui/app_list/test/app_list_test_model.cc
ui/app_list/test/app_list_test_model.h
ui/app_list/views/app_list_main_view_unittest.cc
ui/app_list/views/apps_grid_view.cc
ui/app_list/views/apps_grid_view.h
ui/app_list/views/test/apps_grid_view_test_api.cc
ui/app_list/views/test/apps_grid_view_test_api.h
ui/views/view_model.cc