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

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: 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
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..25ae92f1ba4f652984e820296ade2d7e2dba1287 100644
--- a/chrome/browser/search/search_unittest.cc
+++ b/chrome/browser/search/search_unittest.cc
@@ -919,27 +919,80 @@ 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, OriginChipLeftOfLocationBar) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:1"));
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEFT_OF_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, OriginChipRightOfLocationBar) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:2"));
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_RIGHT_OF_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, OriginChipLeftOfMenu) {
+ ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
+ "EmbeddedSearch", "Group1 espv:2 origin_chip:3"));
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEFT_OF_MENU, 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_RIGHT_OF_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_RIGHT_OF_LOCATION_BAR, GetOriginChipPosition());
}
-TEST_F(OriginChipTest, CommandLineOriginChip) {
- CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableOriginChip);
+TEST_F(OriginChipTest, CommandLineOriginChipLeftOfLocationBar) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOriginChipLeftOfLocationBar);
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEFT_OF_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, CommandLineOriginChipRightOfLocationBar) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOriginChipRightOfLocationBar);
+ EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_RIGHT_OF_LOCATION_BAR, GetOriginChipPosition());
+}
+
+TEST_F(OriginChipTest, CommandLineOriginChipLeftOfMenu) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOriginChipLeftOfMenu);
EXPECT_TRUE(ShouldDisplayOriginChip());
+ EXPECT_EQ(ORIGIN_CHIP_LEFT_OF_MENU, GetOriginChipPosition());
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698