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

Unified Diff: chrome/browser/profiles/avatar_menu_model_unittest.cc

Issue 12040085: Adding show profile switcher field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/profiles/avatar_menu_model.cc ('k') | chrome/browser/ui/browser_command_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/avatar_menu_model_unittest.cc
diff --git a/chrome/browser/profiles/avatar_menu_model_unittest.cc b/chrome/browser/profiles/avatar_menu_model_unittest.cc
index 2f74f07eebcba4d8da5b10cbbd6e1aaa2baad18f..498ef229f7d442d5df047676b7e7dd953d3afb27 100644
--- a/chrome/browser/profiles/avatar_menu_model_unittest.cc
+++ b/chrome/browser/profiles/avatar_menu_model_unittest.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/profiles/avatar_menu_model.h"
+#include "base/metrics/field_trial.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/avatar_menu_model_observer.h"
#include "chrome/browser/profiles/profile_info_cache.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -164,4 +166,47 @@ TEST_F(AvatarMenuModelTest, ChangeOnNotify) {
EXPECT_EQ(name3, item3.name);
}
+TEST_F(AvatarMenuModelTest, ShowAvatarMenuInTrial) {
+ // If multiple profiles is not enabled, the trial will not be enabled, so it
+ // isn't tested.
+ if (!ProfileManager::IsMultipleProfilesEnabled())
+ return;
+
+ base::FieldTrialList field_trial_list_(NULL);
+ base::FieldTrialList::CreateFieldTrial("ShowProfileSwitcher", "AlwaysShow");
+
+ EXPECT_TRUE(AvatarMenuModel::ShouldShowAvatarMenu());
+}
+
+TEST_F(AvatarMenuModelTest, DontShowAvatarMenu) {
+ string16 name1(ASCIIToUTF16("Test 1"));
+ manager()->CreateTestingProfile("p1", name1, 0);
+
+ EXPECT_FALSE(AvatarMenuModel::ShouldShowAvatarMenu());
+
+ // If multiple profiles is enabled, there are no other cases when we wouldn't
+ // show the menu.
+ if (ProfileManager::IsMultipleProfilesEnabled())
+ return;
+
+ string16 name2(ASCIIToUTF16("Test 2"));
+ manager()->CreateTestingProfile("p2", name2, 0);
+
+ EXPECT_FALSE(AvatarMenuModel::ShouldShowAvatarMenu());
+}
+
+TEST_F(AvatarMenuModelTest, ShowAvatarMenu) {
+ // If multiple profiles is enabled then the menu is never show.
+ if (!ProfileManager::IsMultipleProfilesEnabled())
+ return;
+
+ string16 name1(ASCIIToUTF16("Test 1"));
+ string16 name2(ASCIIToUTF16("Test 2"));
+
+ manager()->CreateTestingProfile("p1", name1, 0);
+ manager()->CreateTestingProfile("p2", name2, 0);
+
+ EXPECT_TRUE(AvatarMenuModel::ShouldShowAvatarMenu());
+}
+
} // namespace
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.cc ('k') | chrome/browser/ui/browser_command_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698