| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/app_list/app_list_item_list.h" | 5 #include "ui/app_list/app_list_item_list.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/app_list/app_list_folder_item.h" | 10 #include "ui/app_list/app_list_folder_item.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 size_t index; | 206 size_t index; |
| 207 EXPECT_TRUE(FindItemIndex(item_1->id(), &index)); | 207 EXPECT_TRUE(FindItemIndex(item_1->id(), &index)); |
| 208 EXPECT_EQ(index, 1u); | 208 EXPECT_EQ(index, 1u); |
| 209 | 209 |
| 210 scoped_ptr<AppListItem> item_removed = RemoveItem(item_1->id()); | 210 scoped_ptr<AppListItem> item_removed = RemoveItem(item_1->id()); |
| 211 EXPECT_EQ(item_removed, item_1); | 211 EXPECT_EQ(item_removed, item_1); |
| 212 EXPECT_FALSE(FindItem(item_1->id())); | 212 EXPECT_FALSE(FindItem(item_1->id())); |
| 213 EXPECT_EQ(item_list_.item_count(), 2u); | 213 EXPECT_EQ(item_list_.item_count(), 2u); |
| 214 EXPECT_EQ(observer_.items_removed(), 1u); | 214 EXPECT_EQ(observer_.items_removed(), 1u); |
| 215 EXPECT_TRUE(VerifyItemListOrdinals()); | 215 EXPECT_TRUE(VerifyItemListOrdinals()); |
| 216 | |
| 217 scoped_ptr<AppListItem> not_found_item = RemoveItem("Bogus"); | |
| 218 EXPECT_FALSE(not_found_item.get()); | |
| 219 } | 216 } |
| 220 | 217 |
| 221 TEST_F(AppListItemListTest, MoveItem) { | 218 TEST_F(AppListItemListTest, MoveItem) { |
| 222 CreateAndAddItem(GetItemId(0)); | 219 CreateAndAddItem(GetItemId(0)); |
| 223 CreateAndAddItem(GetItemId(1)); | 220 CreateAndAddItem(GetItemId(1)); |
| 224 CreateAndAddItem(GetItemId(2)); | 221 CreateAndAddItem(GetItemId(2)); |
| 225 CreateAndAddItem(GetItemId(3)); | 222 CreateAndAddItem(GetItemId(3)); |
| 226 | 223 |
| 227 EXPECT_TRUE(VerifyItemOrder4(0, 1, 2, 3)); | 224 EXPECT_TRUE(VerifyItemOrder4(0, 1, 2, 3)); |
| 228 | 225 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 EXPECT_TRUE(VerifyItemListOrdinals()); | 360 EXPECT_TRUE(VerifyItemListOrdinals()); |
| 364 EXPECT_TRUE(VerifyItemOrder4(2, 0, 3, 1)); | 361 EXPECT_TRUE(VerifyItemOrder4(2, 0, 3, 1)); |
| 365 // last -> last | 362 // last -> last |
| 366 item_list_.SetItemPosition(item_list_.item_at(3), | 363 item_list_.SetItemPosition(item_list_.item_at(3), |
| 367 item_list_.item_at(3)->position().CreateAfter()); | 364 item_list_.item_at(3)->position().CreateAfter()); |
| 368 EXPECT_TRUE(VerifyItemListOrdinals()); | 365 EXPECT_TRUE(VerifyItemListOrdinals()); |
| 369 EXPECT_TRUE(VerifyItemOrder4(2, 0, 3, 1)); | 366 EXPECT_TRUE(VerifyItemOrder4(2, 0, 3, 1)); |
| 370 } | 367 } |
| 371 | 368 |
| 372 } // namespace app_list | 369 } // namespace app_list |
| OLD | NEW |