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

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

Issue 654223009: Standardize usage of virtual/override/final in chrome/browser/profiles/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 <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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // This global variable is used to check that value returned to different 64 // This global variable is used to check that value returned to different
65 // observers is the same. 65 // observers is the same.
66 Profile* g_created_profile; 66 Profile* g_created_profile;
67 67
68 class UnittestProfileManager : public ::ProfileManagerWithoutInit { 68 class UnittestProfileManager : public ::ProfileManagerWithoutInit {
69 public: 69 public:
70 explicit UnittestProfileManager(const base::FilePath& user_data_dir) 70 explicit UnittestProfileManager(const base::FilePath& user_data_dir)
71 : ::ProfileManagerWithoutInit(user_data_dir) {} 71 : ::ProfileManagerWithoutInit(user_data_dir) {}
72 72
73 protected: 73 protected:
74 virtual Profile* CreateProfileHelper( 74 Profile* CreateProfileHelper(const base::FilePath& file_path) override {
75 const base::FilePath& file_path) override {
76 if (!base::PathExists(file_path)) { 75 if (!base::PathExists(file_path)) {
77 if (!base::CreateDirectory(file_path)) 76 if (!base::CreateDirectory(file_path))
78 return NULL; 77 return NULL;
79 } 78 }
80 return new TestingProfile(file_path, NULL); 79 return new TestingProfile(file_path, NULL);
81 } 80 }
82 81
83 virtual Profile* CreateProfileAsyncHelper(const base::FilePath& path, 82 Profile* CreateProfileAsyncHelper(const base::FilePath& path,
84 Delegate* delegate) override { 83 Delegate* delegate) override {
85 // This is safe while all file operations are done on the FILE thread. 84 // This is safe while all file operations are done on the FILE thread.
86 BrowserThread::PostTask( 85 BrowserThread::PostTask(
87 BrowserThread::FILE, FROM_HERE, 86 BrowserThread::FILE, FROM_HERE,
88 base::Bind(base::IgnoreResult(&base::CreateDirectory), path)); 87 base::Bind(base::IgnoreResult(&base::CreateDirectory), path));
89 88
90 return new TestingProfile(path, this); 89 return new TestingProfile(path, this);
91 } 90 }
92 }; 91 };
93 92
94 } // namespace 93 } // namespace
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 expected_path = expected_path.Append(chrome::kGuestProfileDir); 384 expected_path = expected_path.Append(chrome::kGuestProfileDir);
386 EXPECT_EQ(expected_path, guest_path); 385 EXPECT_EQ(expected_path, guest_path);
387 } 386 }
388 387
389 class UnittestGuestProfileManager : public UnittestProfileManager { 388 class UnittestGuestProfileManager : public UnittestProfileManager {
390 public: 389 public:
391 explicit UnittestGuestProfileManager(const base::FilePath& user_data_dir) 390 explicit UnittestGuestProfileManager(const base::FilePath& user_data_dir)
392 : UnittestProfileManager(user_data_dir) {} 391 : UnittestProfileManager(user_data_dir) {}
393 392
394 protected: 393 protected:
395 virtual Profile* CreateProfileHelper( 394 Profile* CreateProfileHelper(const base::FilePath& file_path) override {
396 const base::FilePath& file_path) override {
397 TestingProfile::Builder builder; 395 TestingProfile::Builder builder;
398 builder.SetGuestSession(); 396 builder.SetGuestSession();
399 builder.SetPath(file_path); 397 builder.SetPath(file_path);
400 TestingProfile* testing_profile = builder.Build().release(); 398 TestingProfile* testing_profile = builder.Build().release();
401 return testing_profile; 399 return testing_profile;
402 } 400 }
403 }; 401 };
404 402
405 class ProfileManagerGuestTest : public ProfileManagerTest { 403 class ProfileManagerGuestTest : public ProfileManagerTest {
406 protected: 404 protected:
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 dest_path2.BaseName().MaybeAsASCII()); 1288 dest_path2.BaseName().MaybeAsASCII());
1291 profile_manager->ScheduleProfileForDeletion(dest_path2, 1289 profile_manager->ScheduleProfileForDeletion(dest_path2,
1292 ProfileManager::CreateCallback()); 1290 ProfileManager::CreateCallback());
1293 // 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.
1294 base::RunLoop().RunUntilIdle(); 1292 base::RunLoop().RunUntilIdle();
1295 1293
1296 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 1294 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
1297 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 1295 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
1298 } 1296 }
1299 #endif // !defined(OS_MACOSX) 1297 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698