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

Unified Diff: chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc

Issue 409123002: app_list ExtensionAppModelBuilder: Observe and handle changes to prefs::kHideWebStoreIcon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comment Created 6 years, 5 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
« no previous file with comments | « chrome/browser/ui/app_list/extension_app_model_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
diff --git a/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc b/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
index 195ec58b7faf03fa272e1b703345c80879c6a092..b40c382dd3344c014cfaf6986f519b148c48e443 100644
--- a/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
+++ b/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
@@ -171,20 +171,29 @@ TEST_F(ExtensionAppModelBuilderTest, HideWebStore) {
app_list::AppListModel model1;
ExtensionAppModelBuilder builder1(controller_.get());
builder1.InitializeWithProfile(profile_.get(), &model1);
- std::string content = GetModelContent(&model1);
- EXPECT_NE(std::string::npos, content.find("webstore"));
- EXPECT_NE(std::string::npos, content.find("enterprise_webstore"));
+ EXPECT_TRUE(model1.FindItem(store->id()));
+ EXPECT_TRUE(model1.FindItem(enterprise_store->id()));
// Activate the HideWebStoreIcon policy.
profile_->GetPrefs()->SetBoolean(prefs::kHideWebStoreIcon, true);
- // Web stores should NOT be in the AppListModel.
+ // Now the web stores should not be present anymore.
+ EXPECT_FALSE(model1.FindItem(store->id()));
+ EXPECT_FALSE(model1.FindItem(enterprise_store->id()));
+
+ // Build a new AppListModel; web stores should NOT be present.
app_list::AppListModel model2;
ExtensionAppModelBuilder builder2(controller_.get());
builder2.InitializeWithProfile(profile_.get(), &model2);
- content = GetModelContent(&model2);
- EXPECT_EQ(std::string::npos, content.find("webstore"));
- EXPECT_EQ(std::string::npos, content.find("enterprise_webstore"));
+ EXPECT_FALSE(model2.FindItem(store->id()));
+ EXPECT_FALSE(model2.FindItem(enterprise_store->id()));
+
+ // Deactivate the HideWebStoreIcon policy again.
+ profile_->GetPrefs()->SetBoolean(prefs::kHideWebStoreIcon, false);
+
+ // Now the web stores should have appeared.
+ EXPECT_TRUE(model2.FindItem(store->id()));
+ EXPECT_TRUE(model2.FindItem(enterprise_store->id()));
}
TEST_F(ExtensionAppModelBuilderTest, DisableAndEnable) {
« no previous file with comments | « chrome/browser/ui/app_list/extension_app_model_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698