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

Unified Diff: chrome/browser/search/search_unittest.cc

Issue 134013004: [OriginChip] Add options for the position of the origin chip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comments Created 6 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/search/search.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/search_unittest.cc
diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc
index 49d15daa1399388c75c109af947049e1f8b119c8..812d230110d770b82479041ba1d0a48cbda9ea2c 100644
--- a/chrome/browser/search/search_unittest.cc
+++ b/chrome/browser/search/search_unittest.cc
@@ -913,33 +913,87 @@ TEST_F(OriginChipTest, NotSet) {
ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
"EmbeddedSearch", "Group1 espv:2"));
EXPECT_FALSE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_DISABLED, GetOriginChipPosition());
}
TEST_F(OriginChipTest, NoOriginChip) {
ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
"EmbeddedSearch", "Group1 espv:2 origin_chip:0"));
EXPECT_FALSE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_DISABLED, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, OriginChipLeadingLocationBar) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:1"));
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEADING_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, OriginChipTrailingLocationBar) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:2"));
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_TRAILING_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, OriginChipLeadingMenuButton) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:3"));
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEADING_MENU_BUTTON, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, OriginChipInvalidValue) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:4"));
+ EXPECT_FALSE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_DISABLED, GetOriginChipPosition());
}
TEST_F(OriginChipTest, CommandLineNoOriginChip) {
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableOriginChip);
EXPECT_FALSE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_DISABLED, GetOriginChipPosition());
// Command-line disable should override Finch.
ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
"EmbeddedSearch", "Group1 espv:2 origin_chip:1"));
EXPECT_FALSE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_DISABLED, GetOriginChipPosition());
}
-TEST_F(OriginChipTest, OriginChip) {
+TEST_F(OriginChipTest, CommandLineOriginChip) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableOriginChip);
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_TRAILING_LOCATION_BAR, GetOriginChipPosition());
+
+ // Command-line enable should override Finch.
ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
- "EmbeddedSearch", "Group1 espv:2 origin_chip:1"));
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:0"));
EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_TRAILING_LOCATION_BAR, GetOriginChipPosition());
}
-TEST_F(OriginChipTest, CommandLineOriginChip) {
- CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableOriginChip);
+TEST_F(OriginChipTest, CommandLineOriginChipLeadingLocationBar) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOriginChipLeadingLocationBar);
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEADING_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, CommandLineOriginChipTrailingLocationBar) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOriginChipTrailingLocationBar);
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_TRAILING_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, CommandLineOriginChipLeadingMenuButton) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOriginChipLeadingMenuButton);
EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEADING_MENU_BUTTON, GetOriginChipPosition());
}
} // namespace chrome
« no previous file with comments | « chrome/browser/search/search.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698