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

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

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 class MockObserver { 97 class MockObserver {
98 public: 98 public:
99 MOCK_METHOD2(OnProfileCreated, 99 MOCK_METHOD2(OnProfileCreated,
100 void(Profile* profile, Profile::CreateStatus status)); 100 void(Profile* profile, Profile::CreateStatus status));
101 }; 101 };
102 102
103 ProfileManagerTest() 103 ProfileManagerTest()
104 : local_state_(TestingBrowserProcess::GetGlobal()) { 104 : local_state_(TestingBrowserProcess::GetGlobal()) {
105 } 105 }
106 106
107 virtual void SetUp() { 107 void SetUp() override {
108 // Create a new temporary directory, and store the path 108 // Create a new temporary directory, and store the path
109 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 109 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
110 TestingBrowserProcess::GetGlobal()->SetProfileManager( 110 TestingBrowserProcess::GetGlobal()->SetProfileManager(
111 new UnittestProfileManager(temp_dir_.path())); 111 new UnittestProfileManager(temp_dir_.path()));
112 112
113 #if defined(OS_CHROMEOS) 113 #if defined(OS_CHROMEOS)
114 CommandLine* cl = CommandLine::ForCurrentProcess(); 114 CommandLine* cl = CommandLine::ForCurrentProcess();
115 cl->AppendSwitch(switches::kTestType); 115 cl->AppendSwitch(switches::kTestType);
116 #endif 116 #endif
117 } 117 }
118 118
119 virtual void TearDown() { 119 void TearDown() override {
120 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); 120 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
121 base::RunLoop().RunUntilIdle(); 121 base::RunLoop().RunUntilIdle();
122 } 122 }
123 123
124 // Helper function to create a profile with |name| for a profile |manager|. 124 // Helper function to create a profile with |name| for a profile |manager|.
125 void CreateProfileAsync(ProfileManager* manager, 125 void CreateProfileAsync(ProfileManager* manager,
126 const std::string& name, 126 const std::string& name,
127 bool is_supervised, 127 bool is_supervised,
128 MockObserver* mock_observer) { 128 MockObserver* mock_observer) {
129 manager->CreateProfileAsync( 129 manager->CreateProfileAsync(
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 TestingProfile::Builder builder; 395 TestingProfile::Builder builder;
396 builder.SetGuestSession(); 396 builder.SetGuestSession();
397 builder.SetPath(file_path); 397 builder.SetPath(file_path);
398 TestingProfile* testing_profile = builder.Build().release(); 398 TestingProfile* testing_profile = builder.Build().release();
399 return testing_profile; 399 return testing_profile;
400 } 400 }
401 }; 401 };
402 402
403 class ProfileManagerGuestTest : public ProfileManagerTest { 403 class ProfileManagerGuestTest : public ProfileManagerTest {
404 protected: 404 protected:
405 virtual void SetUp() { 405 void SetUp() override {
406 // Create a new temporary directory, and store the path 406 // Create a new temporary directory, and store the path
407 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 407 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
408 TestingBrowserProcess::GetGlobal()->SetProfileManager( 408 TestingBrowserProcess::GetGlobal()->SetProfileManager(
409 new UnittestGuestProfileManager(temp_dir_.path())); 409 new UnittestGuestProfileManager(temp_dir_.path()));
410 410
411 #if defined(OS_CHROMEOS) 411 #if defined(OS_CHROMEOS)
412 CommandLine* cl = CommandLine::ForCurrentProcess(); 412 CommandLine* cl = CommandLine::ForCurrentProcess();
413 // This switch is needed to skip non-test specific behavior in 413 // This switch is needed to skip non-test specific behavior in
414 // ProfileManager (accessing DBusThreadManager). 414 // ProfileManager (accessing DBusThreadManager).
415 cl->AppendSwitch(switches::kTestType); 415 cl->AppendSwitch(switches::kTestType);
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 dest_path2.BaseName().MaybeAsASCII()); 1288 dest_path2.BaseName().MaybeAsASCII());
1289 profile_manager->ScheduleProfileForDeletion(dest_path2, 1289 profile_manager->ScheduleProfileForDeletion(dest_path2,
1290 ProfileManager::CreateCallback()); 1290 ProfileManager::CreateCallback());
1291 // Spin the message loop so that all the callbacks can finish running. 1291 // Spin the message loop so that all the callbacks can finish running.
1292 base::RunLoop().RunUntilIdle(); 1292 base::RunLoop().RunUntilIdle();
1293 1293
1294 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 1294 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
1295 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 1295 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
1296 } 1296 }
1297 #endif // !defined(OS_MACOSX) 1297 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698