Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / profiles / profile_info_cache_unittest.h
blob40e18f7aa7df6bb21cba10e6099b2bcf22a11eb1
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_
8 #include <set>
10 #include "base/test/scoped_path_override.h"
11 #include "chrome/browser/profiles/profile_info_cache_observer.h"
12 #include "chrome/test/base/testing_profile_manager.h"
13 #include "content/public/test/test_browser_thread_bundle.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 class ProfileInfoCache;
18 namespace base {
19 class FilePath;
22 // Class used to test that ProfileInfoCache does not try to access any
23 // unexpected profile names.
24 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver {
25 public:
26 explicit ProfileNameVerifierObserver(
27 TestingProfileManager* testing_profile_manager);
28 ~ProfileNameVerifierObserver() override;
30 // ProfileInfoCacheObserver overrides:
31 void OnProfileAdded(const base::FilePath& profile_path) override;
32 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override;
33 void OnProfileWasRemoved(const base::FilePath& profile_path,
34 const base::string16& profile_name) override;
35 void OnProfileNameChanged(const base::FilePath& profile_path,
36 const base::string16& old_profile_name) override;
37 void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
39 private:
40 ProfileInfoCache* GetCache();
41 std::set<base::string16> profile_names_;
42 TestingProfileManager* testing_profile_manager_;
43 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver);
46 class ProfileInfoCacheTest : public testing::Test {
47 protected:
48 ProfileInfoCacheTest();
49 ~ProfileInfoCacheTest() override;
51 void SetUp() override;
52 void TearDown() override;
54 ProfileInfoCache* GetCache();
55 base::FilePath GetProfilePath(const std::string& base_name);
56 void ResetCache();
58 protected:
59 TestingProfileManager testing_profile_manager_;
61 private:
62 content::TestBrowserThreadBundle thread_bundle_;
63 ProfileNameVerifierObserver name_observer_;
64 base::ScopedPathOverride user_data_dir_override_;
67 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_