Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / profiles / profile_info_cache_unittest.h
blob1f5ba8ab247ce3f4df5151f189d8e5c7e5e9cd18
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 "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;
17 namespace base {
18 class FilePath;
21 // Class used to test that ProfileInfoCache does not try to access any
22 // unexpected profile names.
23 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver {
24 public:
25 explicit ProfileNameVerifierObserver(
26 TestingProfileManager* testing_profile_manager);
27 virtual ~ProfileNameVerifierObserver();
29 // ProfileInfoCacheObserver overrides:
30 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE;
31 virtual void OnProfileWillBeRemoved(
32 const base::FilePath& profile_path) OVERRIDE;
33 virtual void OnProfileWasRemoved(
34 const base::FilePath& profile_path,
35 const base::string16& profile_name) OVERRIDE;
36 virtual void OnProfileNameChanged(
37 const base::FilePath& profile_path,
38 const base::string16& old_profile_name) OVERRIDE;
39 virtual void OnProfileAvatarChanged(const base::FilePath& profile_path) OVERRIDE;
41 private:
42 ProfileInfoCache* GetCache();
43 std::set<base::string16> profile_names_;
44 TestingProfileManager* testing_profile_manager_;
45 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver);
48 class ProfileInfoCacheTest : public testing::Test {
49 protected:
50 ProfileInfoCacheTest();
51 virtual ~ProfileInfoCacheTest();
53 virtual void SetUp() OVERRIDE;
54 virtual void TearDown() OVERRIDE;
56 ProfileInfoCache* GetCache();
57 base::FilePath GetProfilePath(const std::string& base_name);
58 void ResetCache();
60 protected:
61 TestingProfileManager testing_profile_manager_;
63 private:
64 content::TestBrowserThreadBundle thread_bundle_;
65 ProfileNameVerifierObserver name_observer_;
68 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_