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

Side by Side Diff: chrome/browser/chromeos/profiles/profile_helper.cc

Issue 2711033002: Fix Arc integration test. (Closed)
Patch Set: Created 3 years, 10 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/profiles/profile_helper.h" 5 #include "chrome/browser/chromeos/profiles/profile_helper.h"
6 6
7 #include "base/barrier_closure.h" 7 #include "base/barrier_closure.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 return user_manager::UserManager::Get()->GetPrimaryUser(); 335 return user_manager::UserManager::Get()->GetPrimaryUser();
336 336
337 const std::string& user_name = profile->GetProfileUserName(); 337 const std::string& user_name = profile->GetProfileUserName();
338 for (user_manager::UserList::const_iterator it = 338 for (user_manager::UserList::const_iterator it =
339 user_list_for_testing_.begin(); 339 user_list_for_testing_.begin();
340 it != user_list_for_testing_.end(); 340 it != user_list_for_testing_.end();
341 ++it) { 341 ++it) {
342 if ((*it)->GetAccountId().GetUserEmail() == user_name) 342 if ((*it)->GetAccountId().GetUserEmail() == user_name)
343 return *it; 343 return *it;
344 } 344 }
345
346 // In case of test setup we should always default to primary user. 345 // In case of test setup we should always default to primary user.
347 return user_manager::UserManager::Get()->GetPrimaryUser(); 346 return user_manager::UserManager::Get()->GetPrimaryUser();
348 } 347 }
349 348
350 DCHECK(!content::BrowserThread::IsThreadInitialized( 349 DCHECK(!content::BrowserThread::IsThreadInitialized(
351 content::BrowserThread::UI) || 350 content::BrowserThread::UI) ||
352 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 351 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
353 if (ProfileHelper::IsSigninProfile(profile)) 352 if (ProfileHelper::IsSigninProfile(profile))
354 return NULL; 353 return NULL;
355 354
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void ProfileHelper::RemoveUserFromListForTesting(const AccountId& account_id) { 459 void ProfileHelper::RemoveUserFromListForTesting(const AccountId& account_id) {
461 auto it = 460 auto it =
462 std::find_if(user_list_for_testing_.begin(), user_list_for_testing_.end(), 461 std::find_if(user_list_for_testing_.begin(), user_list_for_testing_.end(),
463 [&account_id](const user_manager::User* user) { 462 [&account_id](const user_manager::User* user) {
464 return user->GetAccountId() == account_id; 463 return user->GetAccountId() == account_id;
465 }); 464 });
466 if (it != user_list_for_testing_.end()) 465 if (it != user_list_for_testing_.end())
467 user_list_for_testing_.erase(it); 466 user_list_for_testing_.erase(it);
468 } 467 }
469 468
469 void ProfileHelper::ClearUserToProfileMappingForTesting() {
lgcheng 2017/02/22 23:36:44 In Arc sync integration tests, users(not browser_t
470 user_list_for_testing_.clear();
471 }
472
470 // static 473 // static
471 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( 474 std::string ProfileHelper::GetUserIdHashByUserIdForTesting(
472 const std::string& user_id) { 475 const std::string& user_id) {
473 return user_id + kUserIdHashSuffix; 476 return user_id + kUserIdHashSuffix;
474 } 477 }
475 478
476 void ProfileHelper::FlushProfile(Profile* profile) { 479 void ProfileHelper::FlushProfile(Profile* profile) {
477 if (!profile_flusher_) 480 if (!profile_flusher_)
478 profile_flusher_.reset(new FileFlusher); 481 profile_flusher_.reset(new FileFlusher);
479 482
(...skipping 11 matching lines...) Expand all
491 DownloadPrefs::FromBrowserContext(profile)->DownloadPath()); 494 DownloadPrefs::FromBrowserContext(profile)->DownloadPath());
492 // Let extension system handle extension files. 495 // Let extension system handle extension files.
493 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName)); 496 excludes.push_back(base::FilePath(extensions::kInstallDirectoryName));
494 // Do not flush Drive cache. 497 // Do not flush Drive cache.
495 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname)); 498 excludes.push_back(base::FilePath(chromeos::kDriveCacheDirname));
496 499
497 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure()); 500 profile_flusher_->RequestFlush(profile->GetPath(), excludes, base::Closure());
498 } 501 }
499 502
500 } // namespace chromeos 503 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698