Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: ui/app_list/app_list_model_unittest.cc

Issue 305013014: Disable folder UI when app sync is disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/app_list/app_list_model_unittest.cc
diff --git a/ui/app_list/app_list_model_unittest.cc b/ui/app_list/app_list_model_unittest.cc
index 3d7619e76a78a153d09ae266aa305276f7035db5..b88a964fe2c64097eaa70850a73c0d97a9c7c805 100644
--- a/ui/app_list/app_list_model_unittest.cc
+++ b/ui/app_list/app_list_model_unittest.cc
@@ -231,7 +231,9 @@ TEST_F(AppListModelTest, AppOrder) {
class AppListModelFolderTest : public AppListModelTest {
public:
- AppListModelFolderTest() {}
+ AppListModelFolderTest() {
+ model_.SetFoldersEnabled(true);
+ }
virtual ~AppListModelFolderTest() {}
// testing::Test overrides:
@@ -466,4 +468,35 @@ TEST_F(AppListModelFolderTest, OemFolder) {
EXPECT_TRUE(item1->position().Equals(item1_pos));
}
+TEST_F(AppListModelFolderTest, DisableFolders) {
+ // Set up a folder with two items and an OEM folder with one item.
+ AppListFolderItem* folder =
+ new AppListFolderItem("folder1", AppListFolderItem::FOLDER_TYPE_NORMAL);
+ model_.AddItem(folder);
+ std::string folder_id = folder->id();
+ AppListItem* item0 = new AppListItem("Item 0");
+ model_.AddItemToFolder(item0, folder_id);
+ AppListItem* item1 = new AppListItem("Item 1");
+ model_.AddItemToFolder(item1, folder_id);
+ AppListFolderItem* folder_item = model_.FindFolderItem(folder_id);
+ ASSERT_TRUE(folder_item);
+ EXPECT_EQ(2u, folder_item->item_list()->item_count());
+ AppListFolderItem* oem_folder =
+ new AppListFolderItem("oem_folder", AppListFolderItem::FOLDER_TYPE_OEM);
+ model_.AddItem(oem_folder);
+ AppListItem* oem_item = new AppListItem("OEM Item");
+ std::string oem_folder_id = oem_folder->id();
+ model_.AddItemToFolder(oem_item, oem_folder_id);
+ EXPECT_EQ("folder1,oem_folder", GetModelContents());
+
+ // Disable folders. Ensure non-oem folder is removed.
+ model_.SetFoldersEnabled(false);
+ ASSERT_FALSE(model_.FindFolderItem(folder_id));
+ ASSERT_TRUE(model_.FindFolderItem(oem_folder_id));
+ EXPECT_EQ("Item 0,Item 1,oem_folder", GetModelContents());
+
+ // Ensure folder creation fails.
+ EXPECT_EQ(std::string(), model_.MergeItems(item0->id(), item1->id()));
+}
+
} // namespace app_list

Powered by Google App Engine
This is Rietveld 408576698