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

Unified Diff: chrome/browser/protector/session_startup_change_unittest.cc

Issue 9968007: [protector] Support for collapsing multiple changes into a single one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 8 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/protector/session_startup_change_unittest.cc
diff --git a/chrome/browser/protector/session_startup_change_unittest.cc b/chrome/browser/protector/session_startup_change_unittest.cc
index 8809853778cab2d11a104a5a4c384d51aae913f2..daac3597d5911f9e1cadd0562d75714503c1cee4 100644
--- a/chrome/browser/protector/session_startup_change_unittest.cc
+++ b/chrome/browser/protector/session_startup_change_unittest.cc
@@ -18,6 +18,11 @@ namespace {
const char kStartupUrl1[] = "http://google.com";
const char kStartupUrl2[] = "http://example.com";
+const char kStartupHost1[] = "google.com";
+const char kStartupHost2[] = "example.com";
+
+const BaseSettingChange::DisplayName kNoDisplayName(
+ BaseSettingChange::kDefaultNamePriority, string16());
} // namespace
@@ -89,6 +94,8 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
backup_startup_pref, empty_pinned_tabs_));
ASSERT_TRUE(change->Init(&profile_));
EXPECT_EQ(open_ntp_caption, change->GetApplyButtonText());
+ EXPECT_EQ(GURL(), change->GetNewSettingURL());
+ EXPECT_EQ(kNoDisplayName, change->GetApplyDisplayName());
// Pinned tabs count as startup URLs as well.
PinnedTabCodec::Tabs new_pinned_tabs;
@@ -100,6 +107,8 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
backup_startup_pref, empty_pinned_tabs_));
ASSERT_TRUE(change->Init(&profile_));
EXPECT_EQ(open_url2_etc_caption, change->GetApplyButtonText());
+ EXPECT_EQ(GURL(kStartupUrl2), change->GetNewSettingURL());
+ EXPECT_EQ(UTF8ToUTF16(kStartupHost2), change->GetApplyDisplayName().second);
// "Open URLs" with no URLs is the same as "Open NTP".
initial_startup_pref_.type = SessionStartupPref::URLS;
@@ -108,6 +117,8 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
backup_startup_pref, empty_pinned_tabs_));
ASSERT_TRUE(change->Init(&profile_));
EXPECT_EQ(open_ntp_caption, change->GetApplyButtonText());
+ EXPECT_EQ(GURL(), change->GetNewSettingURL());
+ EXPECT_EQ(kNoDisplayName, change->GetApplyDisplayName());
// Single URL.
initial_startup_pref_.urls.push_back(GURL(kStartupUrl1));
@@ -116,6 +127,8 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
backup_startup_pref, empty_pinned_tabs_));
ASSERT_TRUE(change->Init(&profile_));
EXPECT_EQ(open_url1_etc_caption, change->GetApplyButtonText());
+ EXPECT_EQ(GURL(kStartupUrl1), change->GetNewSettingURL());
+ EXPECT_EQ(UTF8ToUTF16(kStartupHost1), change->GetApplyDisplayName().second);
// Multiple URLs: name of the first one used.
initial_startup_pref_.urls.push_back(GURL(kStartupUrl2));
@@ -124,6 +137,8 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
backup_startup_pref, empty_pinned_tabs_));
ASSERT_TRUE(change->Init(&profile_));
EXPECT_EQ(open_url1_etc_caption, change->GetApplyButtonText());
+ EXPECT_EQ(GURL(kStartupUrl1), change->GetNewSettingURL());
+ EXPECT_EQ(UTF8ToUTF16(kStartupHost1), change->GetApplyDisplayName().second);
// Pinned tabs go after the startup URLs.
change.reset(
@@ -131,6 +146,8 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
backup_startup_pref, empty_pinned_tabs_));
ASSERT_TRUE(change->Init(&profile_));
EXPECT_EQ(open_url1_etc_caption, change->GetApplyButtonText());
+ EXPECT_EQ(GURL(kStartupUrl1), change->GetNewSettingURL());
+ EXPECT_EQ(UTF8ToUTF16(kStartupHost1), change->GetApplyDisplayName().second);
}
} // namespace protector
« no previous file with comments | « chrome/browser/protector/session_startup_change.cc ('k') | chrome/browser/protector/settings_change_global_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698