OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/threading/thread_restrictions.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h" | 11 #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h" |
11 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
12 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
13 #include "chromeos/chromeos_switches.h" | 14 #include "chromeos/chromeos_switches.h" |
14 #include "components/session_manager/core/session_manager.h" | 15 #include "components/session_manager/core/session_manager.h" |
15 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
16 #include "components/user_manager/user_manager.h" | 17 #include "components/user_manager/user_manager.h" |
17 | 18 |
18 namespace file_manager { | 19 namespace file_manager { |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash( | 625 Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash( |
625 kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash); | 626 kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash); |
626 return profile ? profile : FileManagerBrowserTestBase::profile(); | 627 return profile ? profile : FileManagerBrowserTestBase::profile(); |
627 } | 628 } |
628 | 629 |
629 // Sets the test case name (used as a function name in test_cases.js to call.) | 630 // Sets the test case name (used as a function name in test_cases.js to call.) |
630 void set_test_case_name(const std::string& name) { test_case_name_ = name; } | 631 void set_test_case_name(const std::string& name) { test_case_name_ = name; } |
631 | 632 |
632 // Adds a new user for testing to the current session. | 633 // Adds a new user for testing to the current session. |
633 void AddUser(const TestAccountInfo& info, bool log_in) { | 634 void AddUser(const TestAccountInfo& info, bool log_in) { |
| 635 base::ThreadRestrictions::ScopedAllowIO allow_io; |
634 const AccountId account_id(AccountId::FromUserEmail(info.email)); | 636 const AccountId account_id(AccountId::FromUserEmail(info.email)); |
635 if (log_in) { | 637 if (log_in) { |
636 session_manager::SessionManager::Get()->CreateSession(account_id, | 638 session_manager::SessionManager::Get()->CreateSession(account_id, |
637 info.hash); | 639 info.hash); |
638 } | 640 } |
639 user_manager::UserManager::Get()->SaveUserDisplayName( | 641 user_manager::UserManager::Get()->SaveUserDisplayName( |
640 account_id, base::UTF8ToUTF16(info.display_name)); | 642 account_id, base::UTF8ToUTF16(info.display_name)); |
641 SigninManagerFactory::GetForProfile( | 643 SigninManagerFactory::GetForProfile( |
642 chromeos::ProfileHelper::GetProfileByUserIdHash(info.hash)) | 644 chromeos::ProfileHelper::GetProfileByUserIdHash(info.hash)) |
643 ->SetAuthenticatedAccountInfo(info.gaia_id, info.email); | 645 ->SetAuthenticatedAccountInfo(info.gaia_id, info.email); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 694 |
693 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, MAYBE_BasicDrive) { | 695 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, MAYBE_BasicDrive) { |
694 AddAllUsers(); | 696 AddAllUsers(); |
695 | 697 |
696 // Sanity check that normal operations work in multi-profile setting as well. | 698 // Sanity check that normal operations work in multi-profile setting as well. |
697 set_test_case_name("keyboardCopyDrive"); | 699 set_test_case_name("keyboardCopyDrive"); |
698 StartTest(); | 700 StartTest(); |
699 } | 701 } |
700 | 702 |
701 } // namespace file_manager | 703 } // namespace file_manager |
OLD | NEW |