| Index: chrome/browser/profiles/profile_attributes_storage_unittest.cc
|
| diff --git a/chrome/browser/profiles/profile_attributes_storage_unittest.cc b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
|
| index b789da40ba4ba4df09f377c08e59982fe62d547d..fc1ef5dc61683262515f6b9d3a81f122c5a047f5 100644
|
| --- a/chrome/browser/profiles/profile_attributes_storage_unittest.cc
|
| +++ b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
|
| @@ -12,12 +12,17 @@
|
| #include "chrome/browser/profiles/profile_avatar_icon_util.h"
|
| #include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/browser/signin/signin_util.h"
|
| #include "chrome/browser/supervised_user/supervised_user_constants.h"
|
| #include "chrome/test/base/testing_browser_process.h"
|
| #include "chrome/test/base/testing_profile_manager.h"
|
| #include "content/public/test/test_browser_thread_bundle.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +using ::testing::Mock;
|
| +using ::testing::_;
|
| +
|
| namespace {
|
| // The ProfileMetadataEntry accessors aren't just plain old accessors to local
|
| // members so they'll be tested. The following helpers will make the testing
|
| @@ -132,6 +137,13 @@ class ProfileAttributesStorageTest : public testing::Test {
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| };
|
|
|
| +class ProfileAttributesTestObserver
|
| + : public ProfileAttributesStorage::Observer {
|
| + public:
|
| + MOCK_METHOD1(OnProfileSigninRequiredChanged,
|
| + void(const base::FilePath& profile_path));
|
| +};
|
| +
|
| TEST_F(ProfileAttributesStorageTest, ProfileNotFound) {
|
| EXPECT_EQ(0U, storage()->GetNumberOfProfiles());
|
|
|
| @@ -436,3 +448,30 @@ TEST_F(ProfileAttributesStorageTest, ChooseAvatarIconIndexForNewProfile) {
|
| storage()->ChooseAvatarIconIndexForNewProfile());
|
| }
|
| }
|
| +
|
| +TEST_F(ProfileAttributesStorageTest, ProfileForceSigninLock) {
|
| + signin_util::SetForceSigninForTesting(true);
|
| + ProfileAttributesTestObserver observer;
|
| + ProfileAttributesEntry* entry;
|
| +
|
| + AddTestingProfile();
|
| + ASSERT_TRUE(storage()->GetProfileAttributesWithPath(
|
| + GetProfilePath("testing_profile_path0"), &entry));
|
| + storage()->AddObserver(&observer);
|
| + ASSERT_FALSE(entry->IsSigninRequired());
|
| +
|
| + EXPECT_CALL(observer, OnProfileSigninRequiredChanged(_)).Times(0);
|
| + entry->LockForceSigninProfile(false);
|
| + ASSERT_FALSE(entry->IsSigninRequired());
|
| + Mock::VerifyAndClear(&observer);
|
| +
|
| + EXPECT_CALL(observer, OnProfileSigninRequiredChanged(_)).Times(1);
|
| + entry->LockForceSigninProfile(true);
|
| + ASSERT_TRUE(entry->IsSigninRequired());
|
| + Mock::VerifyAndClear(&observer);
|
| +
|
| + EXPECT_CALL(observer, OnProfileSigninRequiredChanged(_)).Times(1);
|
| + entry->SetIsSigninRequired(false);
|
| + ASSERT_FALSE(entry->IsSigninRequired());
|
| + Mock::VerifyAndClear(&observer);
|
| +}
|
|
|