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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 1312693005: Remove migration of obsolete value for "session.restore_on_startup". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url-to-restore-on-startup
Patch Set: Remove unused free function Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 } 3186 }
3187 3187
3188 void SetUpOnMainThread() override { 3188 void SetUpOnMainThread() override {
3189 BrowserThread::PostTask( 3189 BrowserThread::PostTask(
3190 BrowserThread::IO, 3190 BrowserThread::IO,
3191 FROM_HERE, 3191 FROM_HERE,
3192 base::Bind( 3192 base::Bind(
3193 RedirectHostsToTestData, kRestoredURLs, arraysize(kRestoredURLs))); 3193 RedirectHostsToTestData, kRestoredURLs, arraysize(kRestoredURLs)));
3194 } 3194 }
3195 3195
3196 void HomepageIsNotNTP() {
gab 2015/08/27 17:52:48 Seems we're removing an unintentionally supported
bartfab (slow) 2015/08/31 15:36:43 I did some analysis and pinged the thread with my
3197 // Verifies that policy can set the startup pages to the homepage, when
3198 // the homepage is not the NTP.
3199 PolicyMap policies;
3200 policies.Set(
3201 key::kRestoreOnStartup,
3202 POLICY_LEVEL_MANDATORY,
3203 POLICY_SCOPE_USER,
3204 new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage),
3205 NULL);
3206 policies.Set(key::kHomepageIsNewTabPage,
3207 POLICY_LEVEL_MANDATORY,
3208 POLICY_SCOPE_USER,
3209 new base::FundamentalValue(false),
3210 NULL);
3211 policies.Set(key::kHomepageLocation,
3212 POLICY_LEVEL_MANDATORY,
3213 POLICY_SCOPE_USER,
3214 new base::StringValue(kRestoredURLs[1]),
3215 NULL);
3216 provider_.UpdateChromePolicy(policies);
3217
3218 expected_urls_.push_back(GURL(kRestoredURLs[1]));
3219 }
3220
3221 void HomepageIsNTP() {
3222 // Verifies that policy can set the startup pages to the homepage, when
3223 // the homepage is the NTP.
3224 PolicyMap policies;
3225 policies.Set(
3226 key::kRestoreOnStartup,
3227 POLICY_LEVEL_MANDATORY,
3228 POLICY_SCOPE_USER,
3229 new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage),
3230 NULL);
3231 policies.Set(key::kHomepageIsNewTabPage,
3232 POLICY_LEVEL_MANDATORY,
3233 POLICY_SCOPE_USER,
3234 new base::FundamentalValue(true),
3235 NULL);
3236 provider_.UpdateChromePolicy(policies);
3237
3238 expected_urls_.push_back(GURL(chrome::kChromeUINewTabURL));
3239 }
3240
3241 void ListOfURLs() { 3196 void ListOfURLs() {
3242 // Verifies that policy can set the startup pages to a list of URLs. 3197 // Verifies that policy can set the startup pages to a list of URLs.
3243 base::ListValue urls; 3198 base::ListValue urls;
3244 for (size_t i = 0; i < arraysize(kRestoredURLs); ++i) { 3199 for (size_t i = 0; i < arraysize(kRestoredURLs); ++i) {
3245 urls.Append(new base::StringValue(kRestoredURLs[i])); 3200 urls.Append(new base::StringValue(kRestoredURLs[i]));
3246 expected_urls_.push_back(GURL(kRestoredURLs[i])); 3201 expected_urls_.push_back(GURL(kRestoredURLs[i]));
3247 } 3202 }
3248 PolicyMap policies; 3203 PolicyMap policies;
3249 policies.Set(key::kRestoreOnStartup, 3204 policies.Set(key::kRestoreOnStartup,
3250 POLICY_LEVEL_MANDATORY, 3205 POLICY_LEVEL_MANDATORY,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 int size = static_cast<int>(expected_urls_.size()); 3269 int size = static_cast<int>(expected_urls_.size());
3315 EXPECT_EQ(size, model->count()); 3270 EXPECT_EQ(size, model->count());
3316 for (int i = 0; i < size && i < model->count(); ++i) { 3271 for (int i = 0; i < size && i < model->count(); ++i) {
3317 EXPECT_EQ(expected_urls_[i], model->GetWebContentsAt(i)->GetURL()); 3272 EXPECT_EQ(expected_urls_[i], model->GetWebContentsAt(i)->GetURL());
3318 } 3273 }
3319 } 3274 }
3320 3275
3321 INSTANTIATE_TEST_CASE_P( 3276 INSTANTIATE_TEST_CASE_P(
3322 RestoreOnStartupPolicyTestInstance, 3277 RestoreOnStartupPolicyTestInstance,
3323 RestoreOnStartupPolicyTest, 3278 RestoreOnStartupPolicyTest,
3324 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP, 3279 testing::Values(&RestoreOnStartupPolicyTest::ListOfURLs,
3325 &RestoreOnStartupPolicyTest::HomepageIsNTP,
3326 &RestoreOnStartupPolicyTest::ListOfURLs,
3327 &RestoreOnStartupPolicyTest::NTP, 3280 &RestoreOnStartupPolicyTest::NTP,
3328 &RestoreOnStartupPolicyTest::Last)); 3281 &RestoreOnStartupPolicyTest::Last));
3329 3282
3330 // Similar to PolicyTest but sets a couple of policies before the browser is 3283 // Similar to PolicyTest but sets a couple of policies before the browser is
3331 // started. 3284 // started.
3332 class PolicyStatisticsCollectorTest : public PolicyTest { 3285 class PolicyStatisticsCollectorTest : public PolicyTest {
3333 public: 3286 public:
3334 PolicyStatisticsCollectorTest() {} 3287 PolicyStatisticsCollectorTest() {}
3335 ~PolicyStatisticsCollectorTest() override {} 3288 ~PolicyStatisticsCollectorTest() override {}
3336 3289
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
3856 3809
3857 IN_PROC_BROWSER_TEST_F(HardwareAccelerationModePolicyTest, 3810 IN_PROC_BROWSER_TEST_F(HardwareAccelerationModePolicyTest,
3858 HardwareAccelerationDisabled) { 3811 HardwareAccelerationDisabled) {
3859 // Verifies that hardware acceleration can be disabled with policy. 3812 // Verifies that hardware acceleration can be disabled with policy.
3860 EXPECT_FALSE( 3813 EXPECT_FALSE(
3861 content::GpuDataManager::GetInstance()->GpuAccessAllowed(nullptr)); 3814 content::GpuDataManager::GetInstance()->GpuAccessAllowed(nullptr));
3862 } 3815 }
3863 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 3816 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
3864 3817
3865 } // namespace policy 3818 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/session_startup_pref.h » ('j') | chrome/browser/prefs/session_startup_pref.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698