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

Unified Diff: chrome/browser/supervised_user/supervised_user_service_unittest.cc

Issue 480513004: Stopping the history recording for a supervised user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/supervised_user/supervised_user_service_unittest.cc
diff --git a/chrome/browser/supervised_user/supervised_user_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_service_unittest.cc
index bc68d836c399d1ecf61b0b6d6cd4b9a048587eb8..9aa95d0a1051fca5b264496ccf7b7c6e4022e35d 100644
--- a/chrome/browser/supervised_user/supervised_user_service_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_service_unittest.cc
@@ -16,8 +16,11 @@
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/supervised_user/custodian_profile_downloader_service.h"
#include "chrome/browser/supervised_user/custodian_profile_downloader_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_constants.h"
#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/features/feature_channel.h"
@@ -154,6 +157,25 @@ TEST_F(SupervisedUserServiceTest, GetManualExceptionsForHost) {
supervised_user_service_->GetManualBehaviorForURL(kMooseURL));
}
+TEST_F(SupervisedUserServiceTest, ChangesSessionSyncOnChangedSettings) {
+ DictionaryPrefUpdate update(profile_->GetPrefs(),
Marc Treib 2014/08/19 14:00:28 What does this do? Do you actually need the Dictio
+ prefs::kSupervisedUserManualURLs);
+ syncer::ModelTypeSet active_data_types =
+ ProfileSyncServiceFactory::GetForProfile(
+ supervised_user_service_->profile_)->GetActiveDataTypes();
Marc Treib 2014/08/19 14:06:29 Is the PSS actually properly set up in a unit test
+ base::DictionaryValue* dict = update.Get();
Marc Treib 2014/08/19 14:00:28 Please move this below the EXPECTs, right before i
+ dict->SetBooleanWithoutPathExpansion(supervised_users::kRecordHistory, false);
+ EXPECT_TRUE(supervised_user_service_->MaySyncSessions());
+ EXPECT_TRUE(active_data_types.Has(syncer::SESSIONS));
+
+ supervised_user_service_->OnNewSettingsAvailable(dict);
+ EXPECT_FALSE(supervised_user_service_->MaySyncSessions());
+ dict->SetBooleanWithoutPathExpansion(supervised_users::kRecordHistory, true);
+ bool changed_state = supervised_user_service_->FetchNewSessionSyncState(dict);
+
+ ASSERT_TRUE(changed_state);
Marc Treib 2014/08/19 14:00:28 Why is this not an EXPECT? Also, maybe just inline
+}
+
// Ensure that the CustodianProfileDownloaderService shuts down cleanly. If no
// DCHECK is hit when the service is destroyed, this test passed.
TEST_F(SupervisedUserServiceTest, ShutDownCustodianProfileDownloader) {

Powered by Google App Engine
This is Rietveld 408576698