OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/path_service.h" | 5 #include "base/path_service.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "base/prefs/scoped_user_pref_update.h" | 7 #include "base/prefs/scoped_user_pref_update.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 supervised_user_service_->GetManualBehaviorForURL(kExampleBarURL)); | 147 supervised_user_service_->GetManualBehaviorForURL(kExampleBarURL)); |
148 EXPECT_EQ(SupervisedUserService::MANUAL_ALLOW, | 148 EXPECT_EQ(SupervisedUserService::MANUAL_ALLOW, |
149 supervised_user_service_->GetManualBehaviorForURL( | 149 supervised_user_service_->GetManualBehaviorForURL( |
150 kExampleFooNoWWWURL)); | 150 kExampleFooNoWWWURL)); |
151 EXPECT_EQ(SupervisedUserService::MANUAL_ALLOW, | 151 EXPECT_EQ(SupervisedUserService::MANUAL_ALLOW, |
152 supervised_user_service_->GetManualBehaviorForURL(kBlurpURL)); | 152 supervised_user_service_->GetManualBehaviorForURL(kBlurpURL)); |
153 EXPECT_EQ(SupervisedUserService::MANUAL_NONE, | 153 EXPECT_EQ(SupervisedUserService::MANUAL_NONE, |
154 supervised_user_service_->GetManualBehaviorForURL(kMooseURL)); | 154 supervised_user_service_->GetManualBehaviorForURL(kMooseURL)); |
155 } | 155 } |
156 | 156 |
| 157 TEST_F(SupervisedUserServiceTest, ChangesIncludedSessionOnChangedSettings) { |
| 158 supervised_user_service_->Init(); |
| 159 EXPECT_TRUE(supervised_user_service_->IncludesSyncSessionsType()); |
| 160 profile_->GetPrefs()->SetBoolean(prefs::kRecordHistory, false); |
| 161 EXPECT_FALSE(supervised_user_service_->IncludesSyncSessionsType()); |
| 162 } |
| 163 |
157 // Ensure that the CustodianProfileDownloaderService shuts down cleanly. If no | 164 // Ensure that the CustodianProfileDownloaderService shuts down cleanly. If no |
158 // DCHECK is hit when the service is destroyed, this test passed. | 165 // DCHECK is hit when the service is destroyed, this test passed. |
159 TEST_F(SupervisedUserServiceTest, ShutDownCustodianProfileDownloader) { | 166 TEST_F(SupervisedUserServiceTest, ShutDownCustodianProfileDownloader) { |
160 CustodianProfileDownloaderService* downloader_service = | 167 CustodianProfileDownloaderService* downloader_service = |
161 CustodianProfileDownloaderServiceFactory::GetForProfile(profile_.get()); | 168 CustodianProfileDownloaderServiceFactory::GetForProfile(profile_.get()); |
162 | 169 |
163 // Emulate being logged in, then start to download a profile so a | 170 // Emulate being logged in, then start to download a profile so a |
164 // ProfileDownloader gets created. | 171 // ProfileDownloader gets created. |
165 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "Logged In"); | 172 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "Logged In"); |
166 downloader_service->DownloadProfile(base::Bind(&OnProfileDownloadedFail)); | 173 downloader_service->DownloadProfile(base::Bind(&OnProfileDownloadedFail)); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 site_lists[0]->GetSites(&sites); | 421 site_lists[0]->GetSites(&sites); |
415 ASSERT_EQ(1u, sites.size()); | 422 ASSERT_EQ(1u, sites.size()); |
416 EXPECT_EQ(base::ASCIIToUTF16("Moose"), sites[0].name); | 423 EXPECT_EQ(base::ASCIIToUTF16("Moose"), sites[0].name); |
417 | 424 |
418 EXPECT_EQ(SupervisedUserURLFilter::WARN, | 425 EXPECT_EQ(SupervisedUserURLFilter::WARN, |
419 url_filter->GetFilteringBehaviorForURL(example_url)); | 426 url_filter->GetFilteringBehaviorForURL(example_url)); |
420 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, | 427 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, |
421 url_filter->GetFilteringBehaviorForURL(moose_url)); | 428 url_filter->GetFilteringBehaviorForURL(moose_url)); |
422 } | 429 } |
423 #endif // !defined(OS_ANDROID) | 430 #endif // !defined(OS_ANDROID) |
OLD | NEW |