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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc

Issue 1425093004: Revert of This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 56 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
59 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 59 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
62 #include "chrome/common/chrome_constants.h" 62 #include "chrome/common/chrome_constants.h"
63 #include "chrome/common/chrome_switches.h" 63 #include "chrome/common/chrome_switches.h"
64 #include "chrome/test/base/testing_browser_process.h" 64 #include "chrome/test/base/testing_browser_process.h"
65 #include "chrome/test/base/testing_profile_manager.h" 65 #include "chrome/test/base/testing_profile_manager.h"
66 #include "components/signin/core/account_id/account_id.h"
67 #include "components/user_manager/fake_user_manager.h" 66 #include "components/user_manager/fake_user_manager.h"
68 #include "content/public/browser/web_contents_observer.h" 67 #include "content/public/browser/web_contents_observer.h"
69 #include "content/public/test/test_utils.h" 68 #include "content/public/test/test_utils.h"
70 #include "extensions/browser/app_window/app_window_contents.h" 69 #include "extensions/browser/app_window/app_window_contents.h"
71 #include "extensions/browser/app_window/app_window_registry.h" 70 #include "extensions/browser/app_window/app_window_registry.h"
72 #include "extensions/browser/app_window/native_app_window.h" 71 #include "extensions/browser/app_window/native_app_window.h"
73 #include "ui/aura/window.h" 72 #include "ui/aura/window.h"
74 #endif 73 #endif
75 74
76 #if defined(USE_AURA) 75 #if defined(USE_AURA)
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // A Task is leaked if we don't destroy everything, then run the message 801 // A Task is leaked if we don't destroy everything, then run the message
803 // loop. 802 // loop.
804 base::MessageLoop::current()->PostTask( 803 base::MessageLoop::current()->PostTask(
805 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 804 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
806 base::MessageLoop::current()->Run(); 805 base::MessageLoop::current()->Run();
807 } 806 }
808 807
809 // Creates a profile for a given |user_name|. Note that this class will keep 808 // Creates a profile for a given |user_name|. Note that this class will keep
810 // the ownership of the created object. 809 // the ownership of the created object.
811 TestingProfile* CreateMultiUserProfile(const std::string& user_name) { 810 TestingProfile* CreateMultiUserProfile(const std::string& user_name) {
812 const std::string email_string = user_name + "@example.com"; 811 std::string email_string = user_name + "@example.com";
813 const AccountId account_id(AccountId::FromUserEmail(email_string));
814 static_cast<ash::test::TestSessionStateDelegate*>( 812 static_cast<ash::test::TestSessionStateDelegate*>(
815 ash::Shell::GetInstance()->session_state_delegate()) 813 ash::Shell::GetInstance()->session_state_delegate())
816 ->AddUser(account_id.GetUserEmail()); 814 ->AddUser(email_string);
817 // Add a user to the fake user manager. 815 // Add a user to the fake user manager.
818 session_delegate()->AddUser(account_id.GetUserEmail()); 816 session_delegate()->AddUser(email_string);
819 GetFakeUserManager()->AddUser(account_id); 817 GetFakeUserManager()->AddUser(email_string);
820 818
821 GetFakeUserManager()->LoginUser(account_id); 819 GetFakeUserManager()->LoginUser(email_string);
822 820
823 TestingProfile* profile = 821 TestingProfile* profile =
824 profile_manager()->CreateTestingProfile(account_id.GetUserEmail()); 822 profile_manager()->CreateTestingProfile(email_string);
825 EXPECT_TRUE(profile); 823 EXPECT_TRUE(profile);
826 824
827 // Remember the profile name so that we can destroy it upon destruction. 825 // Remember the profile name so that we can destroy it upon destruction.
828 created_profiles_[profile] = account_id.GetUserEmail(); 826 created_profiles_[profile] = email_string;
829 if (chrome::MultiUserWindowManager::GetInstance()) 827 if (chrome::MultiUserWindowManager::GetInstance())
830 chrome::MultiUserWindowManager::GetInstance()->AddUser(profile); 828 chrome::MultiUserWindowManager::GetInstance()->AddUser(profile);
831 if (launcher_controller_) 829 if (launcher_controller_)
832 launcher_controller_->AdditionalUserAddedToSession(profile); 830 launcher_controller_->AdditionalUserAddedToSession(profile);
833 return profile; 831 return profile;
834 } 832 }
835 833
836 // Switch to another user. 834 // Switch to another user.
837 void SwitchActiveUser(const std::string& name) { 835 void SwitchActiveUser(const std::string& name) {
838 const AccountId account_id(AccountId::FromUserEmail(name)); 836 session_delegate()->SwitchActiveUser(name);
839 session_delegate()->SwitchActiveUser(account_id.GetUserEmail()); 837 GetFakeUserManager()->SwitchActiveUser(name);
840 GetFakeUserManager()->SwitchActiveUser(account_id);
841 chrome::MultiUserWindowManagerChromeOS* manager = 838 chrome::MultiUserWindowManagerChromeOS* manager =
842 static_cast<chrome::MultiUserWindowManagerChromeOS*>( 839 static_cast<chrome::MultiUserWindowManagerChromeOS*>(
843 chrome::MultiUserWindowManager::GetInstance()); 840 chrome::MultiUserWindowManager::GetInstance());
844 manager->SetAnimationSpeedForTest( 841 manager->SetAnimationSpeedForTest(
845 chrome::MultiUserWindowManagerChromeOS::ANIMATION_SPEED_DISABLED); 842 chrome::MultiUserWindowManagerChromeOS::ANIMATION_SPEED_DISABLED);
846 manager->ActiveUserChanged(account_id.GetUserEmail()); 843 manager->ActiveUserChanged(name);
847 launcher_controller_->browser_status_monitor_for_test()->ActiveUserChanged( 844 launcher_controller_->browser_status_monitor_for_test()->
848 account_id.GetUserEmail()); 845 ActiveUserChanged(name);
849 launcher_controller_->app_window_controller_for_test()->ActiveUserChanged( 846 launcher_controller_->app_window_controller_for_test()->
850 account_id.GetUserEmail()); 847 ActiveUserChanged(name);
851 } 848 }
852 849
853 // Creates a browser with a |profile| and load a tab with a |title| and |url|. 850 // Creates a browser with a |profile| and load a tab with a |title| and |url|.
854 scoped_ptr<Browser> CreateBrowserAndTabWithProfile(Profile* profile, 851 scoped_ptr<Browser> CreateBrowserAndTabWithProfile(Profile* profile,
855 const std::string& title, 852 const std::string& title,
856 const std::string& url) { 853 const std::string& url) {
857 scoped_ptr<Browser> browser(CreateBrowserWithTestWindowForProfile(profile)); 854 scoped_ptr<Browser> browser(CreateBrowserWithTestWindowForProfile(profile));
858 chrome::NewTab(browser.get()); 855 chrome::NewTab(browser.get());
859 856
860 browser->window()->Show(); 857 browser->window()->Show();
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 2673
2677 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2674 EXPECT_EQ(1, app_icon_loader->fetch_count());
2678 ASSERT_EQ(initial_size + 1, model_->items().size()); 2675 ASSERT_EQ(initial_size + 1, model_->items().size());
2679 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2676 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2680 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2677 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2681 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2678 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2682 2679
2683 launcher_controller_->UnpinAppWithID("1"); 2680 launcher_controller_->UnpinAppWithID("1");
2684 ASSERT_EQ(initial_size, model_->items().size()); 2681 ASSERT_EQ(initial_size, model_->items().size());
2685 } 2682 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/ui/ash/multi_user/multi_user_context_menu_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698