Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Side by Side Diff: chrome/browser/profiles/profile_info_cache_unittest.h

Issue 9271018: Merge 115621 - Refactor ProfileInfoCacheObserver interface and usage thereof. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/browser/profiles/profile_info_cache_observer.h" 12 #include "chrome/browser/profiles/profile_info_cache_observer.h"
13 #include "chrome/test/base/testing_profile_manager.h" 13 #include "chrome/test/base/testing_profile_manager.h"
14 #include "content/test/test_browser_thread.h" 14 #include "content/test/test_browser_thread.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 class FilePath; 17 class FilePath;
18 class ProfileInfoCache; 18 class ProfileInfoCache;
19 19
20 // Class used to test that ProfileInfoCache does not try to access any 20 // Class used to test that ProfileInfoCache does not try to access any
21 // unexpected profile names. 21 // unexpected profile names.
22 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver { 22 class ProfileNameVerifierObserver : public ProfileInfoCacheObserver {
23 public: 23 public:
24 ProfileNameVerifierObserver(); 24 explicit ProfileNameVerifierObserver(
25 TestingProfileManager* testing_profile_manager);
25 virtual ~ProfileNameVerifierObserver(); 26 virtual ~ProfileNameVerifierObserver();
26 27
27 // ProfileInfoCacheObserver overrides: 28 // ProfileInfoCacheObserver overrides:
28 virtual void OnProfileAdded( 29 virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE;
29 const string16& profile_name, 30 virtual void OnProfileWillBeRemoved(
30 const string16& profile_base_dir, 31 const FilePath& profile_path) OVERRIDE;
32 virtual void OnProfileWasRemoved(
31 const FilePath& profile_path, 33 const FilePath& profile_path,
32 const gfx::Image* avatar_image) OVERRIDE;
33 virtual void OnProfileWillBeRemoved(
34 const string16& profile_name) OVERRIDE;
35 virtual void OnProfileWasRemoved(
36 const string16& profile_name) OVERRIDE; 34 const string16& profile_name) OVERRIDE;
37 virtual void OnProfileNameChanged( 35 virtual void OnProfileNameChanged(
38 const string16& old_profile_name,
39 const string16& new_profile_name) OVERRIDE;
40 virtual void OnProfileAvatarChanged(
41 const string16& profile_name,
42 const string16& profile_base_dir,
43 const FilePath& profile_path, 36 const FilePath& profile_path,
44 const gfx::Image* avatar_image) OVERRIDE; 37 const string16& old_profile_name) OVERRIDE;
38 virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE;
45 39
46 private: 40 private:
41 ProfileInfoCache* GetCache();
47 std::set<string16> profile_names_; 42 std::set<string16> profile_names_;
43 TestingProfileManager* testing_profile_manager_;
48 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver); 44 DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver);
49 }; 45 };
50 46
51 class ProfileInfoCacheTest : public testing::Test { 47 class ProfileInfoCacheTest : public testing::Test {
52 protected: 48 protected:
53 ProfileInfoCacheTest(); 49 ProfileInfoCacheTest();
54 virtual ~ProfileInfoCacheTest(); 50 virtual ~ProfileInfoCacheTest();
55 51
56 virtual void SetUp() OVERRIDE; 52 virtual void SetUp() OVERRIDE;
57 virtual void TearDown() OVERRIDE; 53 virtual void TearDown() OVERRIDE;
58 54
59 ProfileInfoCache* GetCache(); 55 ProfileInfoCache* GetCache();
60 FilePath GetProfilePath(const std::string& base_name); 56 FilePath GetProfilePath(const std::string& base_name);
61 void ResetCache(); 57 void ResetCache();
62 58
63 protected: 59 protected:
64 TestingProfileManager testing_profile_manager_; 60 TestingProfileManager testing_profile_manager_;
65 61
66 private: 62 private:
67 MessageLoopForUI ui_loop_; 63 MessageLoopForUI ui_loop_;
68 content::TestBrowserThread ui_thread_; 64 content::TestBrowserThread ui_thread_;
69 content::TestBrowserThread file_thread_; 65 content::TestBrowserThread file_thread_;
70 ProfileNameVerifierObserver name_observer_; 66 ProfileNameVerifierObserver name_observer_;
71 }; 67 };
72 68
73 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_ 69 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache_observer.h ('k') | chrome/browser/profiles/profile_info_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698