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

Side by Side Diff: chrome/browser/profiles/profile_manager_browsertest.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/password_manager/password_store_factory.h" 9 #include "chrome/browser/password_manager/password_store_factory.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 virtual ~ProfileRemovalObserver() { 72 virtual ~ProfileRemovalObserver() {
73 g_browser_process->profile_manager()->GetProfileInfoCache().RemoveObserver( 73 g_browser_process->profile_manager()->GetProfileInfoCache().RemoveObserver(
74 this); 74 this);
75 } 75 }
76 76
77 std::string last_used_profile_name() { return last_used_profile_name_; } 77 std::string last_used_profile_name() { return last_used_profile_name_; }
78 78
79 // ProfileInfoCacheObserver overrides: 79 // ProfileInfoCacheObserver overrides:
80 virtual void OnProfileWillBeRemoved( 80 virtual void OnProfileWillBeRemoved(
81 const base::FilePath& profile_path) OVERRIDE { 81 const base::FilePath& profile_path) override {
82 last_used_profile_name_ = g_browser_process->local_state()->GetString( 82 last_used_profile_name_ = g_browser_process->local_state()->GetString(
83 prefs::kProfileLastUsed); 83 prefs::kProfileLastUsed);
84 } 84 }
85 85
86 private: 86 private:
87 std::string last_used_profile_name_; 87 std::string last_used_profile_name_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(ProfileRemovalObserver); 89 DISALLOW_COPY_AND_ASSIGN(ProfileRemovalObserver);
90 }; 90 };
91 91
92 // The class serves to retrieve passwords from PasswordStore asynchronously. It 92 // The class serves to retrieve passwords from PasswordStore asynchronously. It
93 // used by ProfileManagerBrowserTest.DeletePasswords on some platforms. 93 // used by ProfileManagerBrowserTest.DeletePasswords on some platforms.
94 class PasswordStoreConsumerVerifier : 94 class PasswordStoreConsumerVerifier :
95 public password_manager::PasswordStoreConsumer { 95 public password_manager::PasswordStoreConsumer {
96 public: 96 public:
97 PasswordStoreConsumerVerifier() : called_(false) {} 97 PasswordStoreConsumerVerifier() : called_(false) {}
98 98
99 virtual void OnGetPasswordStoreResults( 99 virtual void OnGetPasswordStoreResults(
100 const std::vector<autofill::PasswordForm*>& results) OVERRIDE { 100 const std::vector<autofill::PasswordForm*>& results) override {
101 EXPECT_FALSE(called_); 101 EXPECT_FALSE(called_);
102 called_ = true; 102 called_ = true;
103 password_entries_.clear(); 103 password_entries_.clear();
104 password_entries_.assign(results.begin(), results.end()); 104 password_entries_.assign(results.begin(), results.end());
105 } 105 }
106 106
107 bool IsCalled() const { return called_; } 107 bool IsCalled() const { return called_; }
108 108
109 const std::vector<autofill::PasswordForm*>& GetPasswords() const { 109 const std::vector<autofill::PasswordForm*>& GetPasswords() const {
110 return password_entries_.get(); 110 return password_entries_.get();
111 } 111 }
112 private: 112 private:
113 ScopedVector<autofill::PasswordForm> password_entries_; 113 ScopedVector<autofill::PasswordForm> password_entries_;
114 bool called_; 114 bool called_;
115 }; 115 };
116 116
117 } // namespace 117 } // namespace
118 118
119 // This file contains tests for the ProfileManager that require a heavyweight 119 // This file contains tests for the ProfileManager that require a heavyweight
120 // InProcessBrowserTest. These include tests involving profile deletion. 120 // InProcessBrowserTest. These include tests involving profile deletion.
121 121
122 // TODO(jeremy): crbug.com/103355 - These tests should be enabled on all 122 // TODO(jeremy): crbug.com/103355 - These tests should be enabled on all
123 // platforms. 123 // platforms.
124 class ProfileManagerBrowserTest : public InProcessBrowserTest { 124 class ProfileManagerBrowserTest : public InProcessBrowserTest {
125 protected: 125 protected:
126 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 126 virtual void SetUpCommandLine(CommandLine* command_line) override {
127 #if defined(OS_CHROMEOS) 127 #if defined(OS_CHROMEOS)
128 command_line->AppendSwitch( 128 command_line->AppendSwitch(
129 chromeos::switches::kIgnoreUserProfileMappingForTests); 129 chromeos::switches::kIgnoreUserProfileMappingForTests);
130 #endif 130 #endif
131 } 131 }
132 }; 132 };
133 133
134 #if defined(OS_MACOSX) 134 #if defined(OS_MACOSX)
135 135
136 // Delete single profile and make sure a new one is created. 136 // Delete single profile and make sure a new one is created.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Make sure that last used profile preference is set correctly. 209 // Make sure that last used profile preference is set correctly.
210 Profile* last_used = ProfileManager::GetLastUsedProfile(); 210 Profile* last_used = ProfileManager::GetLastUsedProfile();
211 EXPECT_EQ(new_profile_path, last_used->GetPath()); 211 EXPECT_EQ(new_profile_path, last_used->GetPath());
212 } 212 }
213 #endif // OS_MACOSX 213 #endif // OS_MACOSX
214 214
215 #if defined(OS_CHROMEOS) 215 #if defined(OS_CHROMEOS)
216 216
217 class ProfileManagerCrOSBrowserTest : public ProfileManagerBrowserTest { 217 class ProfileManagerCrOSBrowserTest : public ProfileManagerBrowserTest {
218 protected: 218 protected:
219 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 219 virtual void SetUpCommandLine(CommandLine* command_line) override {
220 // Use a user hash other than the default chrome::kTestUserProfileDir 220 // Use a user hash other than the default chrome::kTestUserProfileDir
221 // so that the prefix case is tested. 221 // so that the prefix case is tested.
222 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, 222 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile,
223 "test-user-hash"); 223 "test-user-hash");
224 } 224 }
225 }; 225 };
226 226
227 IN_PROC_BROWSER_TEST_F(ProfileManagerCrOSBrowserTest, GetLastUsedProfile) { 227 IN_PROC_BROWSER_TEST_F(ProfileManagerCrOSBrowserTest, GetLastUsedProfile) {
228 // Make sure that last used profile is correct. 228 // Make sure that last used profile is correct.
229 Profile* last_used_profile = ProfileManager::GetLastUsedProfile(); 229 Profile* last_used_profile = ProfileManager::GetLastUsedProfile();
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 run_loop.QuitClosure()); 443 run_loop.QuitClosure());
444 EXPECT_TRUE(password_store->ScheduleTask(task)); 444 EXPECT_TRUE(password_store->ScheduleTask(task));
445 run_loop.Run(); 445 run_loop.Run();
446 446
447 EXPECT_TRUE(verify_add.IsCalled()); 447 EXPECT_TRUE(verify_add.IsCalled());
448 EXPECT_EQ(1u, verify_add.GetPasswords().size()); 448 EXPECT_EQ(1u, verify_add.GetPasswords().size());
449 EXPECT_TRUE(verify_delete.IsCalled()); 449 EXPECT_TRUE(verify_delete.IsCalled());
450 EXPECT_EQ(0u, verify_delete.GetPasswords().size()); 450 EXPECT_EQ(0u, verify_delete.GetPasswords().size());
451 } 451 }
452 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 452 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698