OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 10 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
11 #include "chrome/test/base/testing_profile_manager.h" | 11 #include "chrome/test/base/testing_profile_manager.h" |
12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 class ProfileInfoCache; | 15 class ProfileInfoCache; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 } | 19 } |
20 | 20 |
21 // Class used to test that ProfileInfoCache does not try to access any | 21 // Class used to test that ProfileInfoCache does not try to access any |
22 // unexpected profile names. | 22 // unexpected profile names. |
23 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver { | 23 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver { |
24 public: | 24 public: |
25 explicit ProfileNameVerifierObserver( | 25 explicit ProfileNameVerifierObserver( |
26 TestingProfileManager* testing_profile_manager); | 26 TestingProfileManager* testing_profile_manager); |
27 virtual ~ProfileNameVerifierObserver(); | 27 virtual ~ProfileNameVerifierObserver(); |
28 | 28 |
29 // ProfileInfoCacheObserver overrides: | 29 // ProfileInfoCacheObserver overrides: |
30 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 30 virtual void OnProfileAdded(const base::FilePath& profile_path) override; |
31 virtual void OnProfileWillBeRemoved( | 31 virtual void OnProfileWillBeRemoved( |
32 const base::FilePath& profile_path) OVERRIDE; | 32 const base::FilePath& profile_path) override; |
33 virtual void OnProfileWasRemoved( | 33 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, |
34 const base::FilePath& profile_path, | 34 const base::string16& profile_name) override; |
35 const base::string16& profile_name) OVERRIDE; | |
36 virtual void OnProfileNameChanged( | 35 virtual void OnProfileNameChanged( |
37 const base::FilePath& profile_path, | 36 const base::FilePath& profile_path, |
38 const base::string16& old_profile_name) OVERRIDE; | 37 const base::string16& old_profile_name) override; |
39 virtual void OnProfileAvatarChanged(const base::FilePath& profile_path) OVERRI
DE; | 38 virtual void OnProfileAvatarChanged( |
| 39 const base::FilePath& profile_path) override; |
40 | 40 |
41 private: | 41 private: |
42 ProfileInfoCache* GetCache(); | 42 ProfileInfoCache* GetCache(); |
43 std::set<base::string16> profile_names_; | 43 std::set<base::string16> profile_names_; |
44 TestingProfileManager* testing_profile_manager_; | 44 TestingProfileManager* testing_profile_manager_; |
45 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver); | 45 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver); |
46 }; | 46 }; |
47 | 47 |
48 class ProfileInfoCacheTest : public testing::Test { | 48 class ProfileInfoCacheTest : public testing::Test { |
49 protected: | 49 protected: |
50 ProfileInfoCacheTest(); | 50 ProfileInfoCacheTest(); |
51 virtual ~ProfileInfoCacheTest(); | 51 virtual ~ProfileInfoCacheTest(); |
52 | 52 |
53 virtual void SetUp() OVERRIDE; | 53 virtual void SetUp() override; |
54 virtual void TearDown() OVERRIDE; | 54 virtual void TearDown() override; |
55 | 55 |
56 ProfileInfoCache* GetCache(); | 56 ProfileInfoCache* GetCache(); |
57 base::FilePath GetProfilePath(const std::string& base_name); | 57 base::FilePath GetProfilePath(const std::string& base_name); |
58 void ResetCache(); | 58 void ResetCache(); |
59 | 59 |
60 protected: | 60 protected: |
61 TestingProfileManager testing_profile_manager_; | 61 TestingProfileManager testing_profile_manager_; |
62 | 62 |
63 private: | 63 private: |
64 content::TestBrowserThreadBundle thread_bundle_; | 64 content::TestBrowserThreadBundle thread_bundle_; |
65 ProfileNameVerifierObserver name_observer_; | 65 ProfileNameVerifierObserver name_observer_; |
66 }; | 66 }; |
67 | 67 |
68 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ | 68 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ |
OLD | NEW |