1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_
10 #include "chrome/browser/profiles/profile_info_cache_observer.h"
11 #include "chrome/test/base/testing_profile_manager.h"
12 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 class ProfileInfoCache
;
21 // Class used to test that ProfileInfoCache does not try to access any
22 // unexpected profile names.
23 class ProfileNameVerifierObserver
: public ProfileInfoCacheObserver
{
25 explicit ProfileNameVerifierObserver(
26 TestingProfileManager
* testing_profile_manager
);
27 ~ProfileNameVerifierObserver() override
;
29 // ProfileInfoCacheObserver overrides:
30 void OnProfileAdded(const base::FilePath
& profile_path
) override
;
31 void OnProfileWillBeRemoved(const base::FilePath
& profile_path
) override
;
32 void OnProfileWasRemoved(const base::FilePath
& profile_path
,
33 const base::string16
& profile_name
) override
;
34 void OnProfileNameChanged(const base::FilePath
& profile_path
,
35 const base::string16
& old_profile_name
) override
;
36 void OnProfileAvatarChanged(const base::FilePath
& profile_path
) override
;
39 ProfileInfoCache
* GetCache();
40 std::set
<base::string16
> profile_names_
;
41 TestingProfileManager
* testing_profile_manager_
;
42 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver
);
45 class ProfileInfoCacheTest
: public testing::Test
{
47 ProfileInfoCacheTest();
48 ~ProfileInfoCacheTest() override
;
50 void SetUp() override
;
51 void TearDown() override
;
53 ProfileInfoCache
* GetCache();
54 base::FilePath
GetProfilePath(const std::string
& base_name
);
58 TestingProfileManager testing_profile_manager_
;
61 content::TestBrowserThreadBundle thread_bundle_
;
62 ProfileNameVerifierObserver name_observer_
;
65 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_