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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 8 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
9 #include "chrome/browser/supervised_user/supervised_user_pref_mapping_service.h" | 9 #include "chrome/browser/supervised_user/supervised_user_pref_mapping_service.h" |
10 #include "chrome/browser/supervised_user/supervised_user_pref_mapping_service_fa
ctory.h" | 10 #include "chrome/browser/supervised_user/supervised_user_pref_mapping_service_fa
ctory.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 SupervisedUserPrefMappingServiceTest() { | 21 SupervisedUserPrefMappingServiceTest() { |
22 profile_.GetPrefs()->SetString(prefs::kSupervisedUserId, | 22 profile_.GetPrefs()->SetString(prefs::kSupervisedUserId, |
23 kFakeSupervisedUserId); | 23 kFakeSupervisedUserId); |
24 shared_settings_service_ = | 24 shared_settings_service_ = |
25 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( | 25 SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( |
26 &profile_); | 26 &profile_); |
27 mapping_service_ = | 27 mapping_service_ = |
28 SupervisedUserPrefMappingServiceFactory::GetForBrowserContext( | 28 SupervisedUserPrefMappingServiceFactory::GetForBrowserContext( |
29 &profile_); | 29 &profile_); |
30 } | 30 } |
31 virtual ~SupervisedUserPrefMappingServiceTest() {} | 31 ~SupervisedUserPrefMappingServiceTest() override {} |
32 | 32 |
33 // testing::Test overrides: | 33 // testing::Test overrides: |
34 virtual void SetUp() override { | 34 void SetUp() override { mapping_service_->Init(); } |
35 mapping_service_->Init(); | |
36 } | |
37 | 35 |
38 virtual void TearDown() override { | 36 void TearDown() override { |
39 mapping_service_->Shutdown(); | 37 mapping_service_->Shutdown(); |
40 shared_settings_service_->Shutdown(); | 38 shared_settings_service_->Shutdown(); |
41 } | 39 } |
42 | 40 |
43 TestingProfile profile_; | 41 TestingProfile profile_; |
44 SupervisedUserSharedSettingsService* shared_settings_service_; | 42 SupervisedUserSharedSettingsService* shared_settings_service_; |
45 SupervisedUserPrefMappingService* mapping_service_; | 43 SupervisedUserPrefMappingService* mapping_service_; |
46 }; | 44 }; |
47 | 45 |
48 TEST_F(SupervisedUserPrefMappingServiceTest, CheckPrefUpdate) { | 46 TEST_F(SupervisedUserPrefMappingServiceTest, CheckPrefUpdate) { |
(...skipping 11 matching lines...) Expand all Loading... |
60 TEST_F(SupervisedUserPrefMappingServiceTest, CheckSharedSettingUpdate) { | 58 TEST_F(SupervisedUserPrefMappingServiceTest, CheckSharedSettingUpdate) { |
61 EXPECT_EQ(profile_.GetPrefs()->GetInteger(prefs::kProfileAvatarIndex), -1); | 59 EXPECT_EQ(profile_.GetPrefs()->GetInteger(prefs::kProfileAvatarIndex), -1); |
62 shared_settings_service_->SetValue(kFakeSupervisedUserId, | 60 shared_settings_service_->SetValue(kFakeSupervisedUserId, |
63 supervised_users::kChromeAvatarIndex, | 61 supervised_users::kChromeAvatarIndex, |
64 base::FundamentalValue(1)); | 62 base::FundamentalValue(1)); |
65 mapping_service_->OnSharedSettingChanged( | 63 mapping_service_->OnSharedSettingChanged( |
66 kFakeSupervisedUserId, | 64 kFakeSupervisedUserId, |
67 supervised_users::kChromeAvatarIndex); | 65 supervised_users::kChromeAvatarIndex); |
68 EXPECT_EQ(profile_.GetPrefs()->GetInteger(prefs::kProfileAvatarIndex), 1); | 66 EXPECT_EQ(profile_.GetPrefs()->GetInteger(prefs::kProfileAvatarIndex), 1); |
69 } | 67 } |
OLD | NEW |