Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / profiles / profile_info_cache_unittest.h
blob640f4da60ef7f750578f4c61ce6b4763a7324cf9
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/message_loop.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.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 class FilePath;
17 class ProfileInfoCache;
19 // Class used to test that ProfileInfoCache does not try to access any
20 // unexpected profile names.
21 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver {
22 public:
23 explicit ProfileNameVerifierObserver(
24 TestingProfileManager* testing_profile_manager);
25 virtual ~ProfileNameVerifierObserver();
27 // ProfileInfoCacheObserver overrides:
28 virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE;
29 virtual void OnProfileWillBeRemoved(
30 const FilePath& profile_path) OVERRIDE;
31 virtual void OnProfileWasRemoved(
32 const FilePath& profile_path,
33 const string16& profile_name) OVERRIDE;
34 virtual void OnProfileNameChanged(
35 const FilePath& profile_path,
36 const string16& old_profile_name) OVERRIDE;
37 virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE;
39 private:
40 ProfileInfoCache* GetCache();
41 std::set<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 virtual ~ProfileInfoCacheTest();
51 virtual void SetUp() OVERRIDE;
52 virtual void TearDown() OVERRIDE;
54 ProfileInfoCache* GetCache();
55 FilePath GetProfilePath(const std::string& base_name);
56 void ResetCache();
58 protected:
59 TestingProfileManager testing_profile_manager_;
61 private:
62 MessageLoopForUI ui_loop_;
63 content::TestBrowserThread ui_thread_;
64 content::TestBrowserThread file_thread_;
65 ProfileNameVerifierObserver name_observer_;
68 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_