Chromium Code Reviews| Index: chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc |
| diff --git a/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc b/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc |
| index 0c35d581bd1d7f9ad032afdd4120b3cf3ff7090e..635e9d06e84b5e125435f57534f53ae1b343aa97 100644 |
| --- a/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc |
| +++ b/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc |
| @@ -12,7 +12,6 @@ |
| #include "base/values.h" |
| #include "chrome/browser/prefs/session_startup_pref.h" |
| #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" |
| -#include "chrome/common/pref_names.h" |
| #include "components/policy/core/browser/configuration_policy_handler.h" |
| #include "components/policy/core/browser/policy_error_map.h" |
| #include "components/policy/core/common/policy_map.h" |
| @@ -70,8 +69,7 @@ TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_Unspecified) { |
| TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_UnknownValue) { |
| // Specify an unknown value for the policy. |
| - int impossible_value = SessionStartupPref::kPrefValueHomePage + |
| - SessionStartupPref::kPrefValueLast + |
| + int impossible_value = SessionStartupPref::kPrefValueLast + |
| SessionStartupPref::kPrefValueURLs + |
| SessionStartupPref::kPrefValueNewTab; |
| SetPolicyValue(key::kRestoreOnStartup, |
| @@ -85,18 +83,6 @@ TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_UnknownValue) { |
| errors().begin()->second); |
| } |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_HomePage) { |
| - // Specify the HomePage value. |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
|
Andrew T Wilson (Slow)
2015/12/08 18:09:34
Let's restore this test.
sdefresne
2015/12/09 18:41:06
Done.
|
| - // Checking should succeed but add an error to the error map. |
| - EXPECT_TRUE(CheckPolicySettings()); |
| - EXPECT_EQ(1U, errors().size()); |
| - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_POLICY_VALUE_DEPRECATED), |
| - errors().begin()->second); |
| -} |
| - |
| TEST_F(RestoreOnStartupPolicyHandlerTest, |
| CheckPolicySettings_RestoreLastSession_SessionCookies) { |
| // Specify the Last value and the Session-Only Cookies value. |
| @@ -178,116 +164,4 @@ TEST_F(RestoreOnStartupPolicyHandlerTest, ApplyPolicySettings_WrongType) { |
| EXPECT_TRUE(prefs().begin() == prefs().end()); |
| } |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, ApplyPolicySettings_NotHomePage) { |
| - // Specify anything except the HomePage value. |
| - int not_home_page = SessionStartupPref::kPrefValueHomePage + 1; |
|
Andrew T Wilson (Slow)
2015/12/08 18:09:34
I think we should restore this test also as it's m
sdefresne
2015/12/09 18:41:05
Done.
|
| - SetPolicyValue(key::kRestoreOnStartup, |
| - new base::FundamentalValue(not_home_page)); |
| - ApplyPolicySettings(); |
| - // The resulting prefs should have the value we specified. |
| - int result; |
| - EXPECT_TRUE(prefs().GetInteger(prefs::kRestoreOnStartup, &result)); |
| - EXPECT_EQ(not_home_page, result); |
| -} |
| - |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, |
| - ApplyPolicySettings_HomePage_NoHomePageValue) { |
| - // Specify the HomePage value but no HomePageIsNewTabPage value. |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
| - ApplyPolicySettings(); |
| - // The resulting prefs should be empty. |
| - EXPECT_TRUE(prefs().begin() == prefs().end()); |
| -} |
| - |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, |
| - ApplyPolicySettings_HomePage_HomePageValueIsWrongType) { |
| - // Specify the HomePage value and an integer for the home page value. |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
| - SetPolicyValue( |
| - key::kHomepageIsNewTabPage, |
| - new base::FundamentalValue(314159)); |
| - ApplyPolicySettings(); |
| - // The resulting prefs should be empty. |
| - EXPECT_TRUE(prefs().begin() == prefs().end()); |
| -} |
| - |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, |
| - ApplyPolicySettings_HomePage_HomePageIsNewTabPage) { |
| - // Specify the HomePage value and the home page as the new tab page. |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
| - SetPolicyValue( |
| - key::kHomepageIsNewTabPage, |
| - new base::FundamentalValue(true)); |
| - ApplyPolicySettings(); |
| - // The resulting prefs should have the restore value as NTP. |
| - int result; |
| - EXPECT_TRUE(prefs().GetInteger(prefs::kRestoreOnStartup, &result)); |
| - int expected = SessionStartupPref::kPrefValueNewTab; |
| - EXPECT_EQ(expected, result); |
| -} |
| - |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, |
| - ApplyPolicySettings_HomePage_HomePageIsNotNewTabPage_NotDefined) { |
| - // Specify the HomePage value but don't specify the home page to use. |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
| - SetPolicyValue( |
| - key::kHomepageIsNewTabPage, |
| - new base::FundamentalValue(false)); |
| - ApplyPolicySettings(); |
| - // The resulting prefs should be empty. |
| - EXPECT_TRUE(prefs().begin() == prefs().end()); |
| -} |
| - |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, |
| - ApplyPolicySettings_HomePage_HomePageIsNotNewTabPage_WrongType) { |
| - // Specify the HomePage value but specify a boolean as the home page. |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
| - SetPolicyValue( |
| - key::kHomepageIsNewTabPage, |
| - new base::FundamentalValue(false)); |
| - SetPolicyValue( |
| - key::kHomepageLocation, |
| - new base::FundamentalValue(false)); |
| - ApplyPolicySettings(); |
| - // The resulting prefs should be empty. |
| - EXPECT_TRUE(prefs().begin() == prefs().end()); |
| -} |
| - |
| -TEST_F(RestoreOnStartupPolicyHandlerTest, |
| - ApplyPolicySettings_HomePage_HomePageIsNotNewTabPage) { |
| - SetPolicyValue( |
| - key::kRestoreOnStartup, |
| - new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage)); |
| - SetPolicyValue(key::kHomepageIsNewTabPage, new base::FundamentalValue(false)); |
| - SetPolicyValue(key::kHomepageLocation, |
| - new base::StringValue("http://foo.com")); |
| - ApplyPolicySettings(); |
| - |
| - // The resulting prefs should have have URLs specified for startup. |
| - int result; |
| - EXPECT_TRUE(prefs().GetInteger(prefs::kRestoreOnStartup, &result)); |
| - int expected = SessionStartupPref::kPrefValueURLs; |
| - EXPECT_EQ(expected, result); |
| - |
| - // The resulting prefs should have the URL we specified as the home page. |
| - base::Value* url_result; |
| - EXPECT_TRUE(prefs().GetValue(prefs::kURLsToRestoreOnStartup, &url_result)); |
| - base::ListValue* url_list_result; |
| - EXPECT_TRUE(url_result->GetAsList(&url_list_result)); |
| - EXPECT_EQ(1U, url_list_result->GetSize()); |
| - std::string expected_url; |
| - EXPECT_TRUE(url_list_result->GetString(0, &expected_url)); |
| - EXPECT_EQ(std::string("http://foo.com"), expected_url); |
| -} |
| - |
| } // namespace policy |