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

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: Format changes, check sync service setup before setting it and test refactoring. 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..f2ae3a362629603717c864ed4c36950c761e9acf 100644
--- a/chrome/browser/supervised_user/supervised_user_service_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_service_unittest.cc
@@ -16,6 +16,7 @@
#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/ui/browser_list.h"
@@ -154,6 +155,26 @@ TEST_F(SupervisedUserServiceTest, GetManualExceptionsForHost) {
supervised_user_service_->GetManualBehaviorForURL(kMooseURL));
}
+TEST_F(SupervisedUserServiceTest, ChangesIncludedSessionOnChangedSettings) {
+ base::DictionaryValue* dict = new base::DictionaryValue();
Marc Treib 2014/08/19 15:28:02 Memleak! Use a scoped_ptr or an instance variable.
fhorschig 2014/08/20 11:59:30 Done.
+ dict->SetBooleanWithoutPathExpansion(supervised_users::kRecordHistory, false);
+
+ supervised_user_service_->OnNewSettingsAvailable(dict);
+
+ EXPECT_FALSE(supervised_user_service_->IncludesSyncSessions());
Marc Treib 2014/08/19 15:28:02 Also check that it was true before OnNewSettingsAv
fhorschig 2014/08/20 11:59:30 Done.
+}
+
+TEST_F(SupervisedUserServiceTest, ChangesSyncSessionStateOnChangedSettings) {
+ base::DictionaryValue* dict = new base::DictionaryValue();
+ dict->SetBooleanWithoutPathExpansion(supervised_users::kRecordHistory, false);
+ supervised_user_service_->OnNewSettingsAvailable(dict);
+ dict->SetBooleanWithoutPathExpansion(supervised_users::kRecordHistory, true);
+
+ bool changed_state = supervised_user_service_->FetchNewSessionSyncState(dict);
+
+ EXPECT_TRUE(changed_state);
+}
+
// 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