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

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

Issue 824683002: UserManager stack refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split for FakeManager complete. Created 5 years, 11 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 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 21 matching lines...) Expand all
32 #include "chrome/browser/ui/browser_finder.h" 32 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_list.h" 33 #include "chrome/browser/ui/browser_list.h"
34 #include "chrome/browser/ui/browser_tabstrip.h" 34 #include "chrome/browser/ui/browser_tabstrip.h"
35 #include "chrome/browser/ui/host_desktop.h" 35 #include "chrome/browser/ui/host_desktop.h"
36 #include "chrome/browser/ui/tabs/tab_strip_model.h" 36 #include "chrome/browser/ui/tabs/tab_strip_model.h"
37 #include "chrome/common/extensions/extension_constants.h" 37 #include "chrome/common/extensions/extension_constants.h"
38 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
39 #include "chrome/test/base/browser_with_test_window_test.h" 39 #include "chrome/test/base/browser_with_test_window_test.h"
40 #include "chrome/test/base/testing_pref_service_syncable.h" 40 #include "chrome/test/base/testing_pref_service_syncable.h"
41 #include "chrome/test/base/testing_profile.h" 41 #include "chrome/test/base/testing_profile.h"
42 #include "components/user_manager/fake_user_manager.h"
42 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
43 #include "extensions/common/extension.h" 44 #include "extensions/common/extension.h"
44 #include "extensions/common/manifest_constants.h" 45 #include "extensions/common/manifest_constants.h"
45 #include "testing/gtest/include/gtest/gtest.h" 46 #include "testing/gtest/include/gtest/gtest.h"
46 #include "ui/aura/client/window_tree_client.h" 47 #include "ui/aura/client/window_tree_client.h"
47 #include "ui/base/models/menu_model.h" 48 #include "ui/base/models/menu_model.h"
48 49
49 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
50 #include "ash/test/test_session_state_delegate.h" 51 #include "ash/test/test_session_state_delegate.h"
51 #include "ash/test/test_shell_delegate.h" 52 #include "ash/test/test_shell_delegate.h"
52 #include "chrome/browser/apps/scoped_keep_alive.h" 53 #include "chrome/browser/apps/scoped_keep_alive.h"
53 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 54 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
54 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 55 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
55 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 56 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
56 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
57 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
58 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 59 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
59 #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"
60 #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"
61 #include "chrome/common/chrome_constants.h" 62 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_switches.h" 63 #include "chrome/common/chrome_switches.h"
63 #include "chrome/test/base/testing_browser_process.h" 64 #include "chrome/test/base/testing_browser_process.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 virtual void SetUp() override { 776 virtual void SetUp() override {
776 profile_manager_.reset( 777 profile_manager_.reset(
777 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 778 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
778 779
779 ASSERT_TRUE(profile_manager_->SetUp()); 780 ASSERT_TRUE(profile_manager_->SetUp());
780 781
781 // AvatarMenu and multiple profiles works after user logged in. 782 // AvatarMenu and multiple profiles works after user logged in.
782 profile_manager_->SetLoggedIn(true); 783 profile_manager_->SetLoggedIn(true);
783 784
784 // Initialize the UserManager singleton to a fresh FakeUserManager instance. 785 // Initialize the UserManager singleton to a fresh FakeUserManager instance.
785 user_manager_enabler_.reset( 786 #if defined(OS_CHROMEOS)
786 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); 787 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler(
788 new chromeos::FakeChromeUserManager));
789 #else // !defined(OS_CHROMEOS)
790 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler(
Nikita (slow) 2015/01/20 18:18:22 It looks like this whole block is under #if defin
merkulova 2015/01/21 14:10:34 Done.
791 new user_manager::FakeUserManager));
792 #endif // defined(OS_CHROMEOS)
787 793
788 // Initialize the rest. 794 // Initialize the rest.
789 ChromeLauncherControllerTest::SetUp(); 795 ChromeLauncherControllerTest::SetUp();
790 796
791 // Get some base objects. 797 // Get some base objects.
792 session_delegate()->set_logged_in_users(2); 798 session_delegate()->set_logged_in_users(2);
793 shell_delegate_ = static_cast<ash::test::TestShellDelegate*>( 799 shell_delegate_ = static_cast<ash::test::TestShellDelegate*>(
794 ash::Shell::GetInstance()->delegate()); 800 ash::Shell::GetInstance()->delegate());
795 shell_delegate_->set_multi_profiles_enabled(true); 801 shell_delegate_->set_multi_profiles_enabled(true);
796 } 802 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 ProfileToNameMap::iterator it = created_profiles_.find(profile); 908 ProfileToNameMap::iterator it = created_profiles_.find(profile);
903 DCHECK(it != created_profiles_.end()); 909 DCHECK(it != created_profiles_.end());
904 profile_manager_->DeleteTestingProfile(it->second); 910 profile_manager_->DeleteTestingProfile(it->second);
905 created_profiles_.erase(it); 911 created_profiles_.erase(it);
906 } 912 }
907 913
908 private: 914 private:
909 typedef std::map<Profile*, std::string> ProfileToNameMap; 915 typedef std::map<Profile*, std::string> ProfileToNameMap;
910 TestingProfileManager* profile_manager() { return profile_manager_.get(); } 916 TestingProfileManager* profile_manager() { return profile_manager_.get(); }
911 917
912 chromeos::FakeUserManager* GetFakeUserManager() { 918 chromeos::FakeChromeUserManager* GetFakeUserManager() {
913 return static_cast<chromeos::FakeUserManager*>( 919 return static_cast<chromeos::FakeChromeUserManager*>(
914 user_manager::UserManager::Get()); 920 user_manager::UserManager::Get());
915 } 921 }
916 922
917 scoped_ptr<TestingProfileManager> profile_manager_; 923 scoped_ptr<TestingProfileManager> profile_manager_;
918 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; 924 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
919 925
920 ash::test::TestShellDelegate* shell_delegate_; 926 ash::test::TestShellDelegate* shell_delegate_;
921 927
922 ProfileToNameMap created_profiles_; 928 ProfileToNameMap created_profiles_;
923 929
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 2686
2681 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2687 EXPECT_EQ(1, app_icon_loader->fetch_count());
2682 ASSERT_EQ(initial_size + 1, model_->items().size()); 2688 ASSERT_EQ(initial_size + 1, model_->items().size());
2683 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2689 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2684 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2690 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2685 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2691 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2686 2692
2687 launcher_controller_->UnpinAppWithID("1"); 2693 launcher_controller_->UnpinAppWithID("1");
2688 ASSERT_EQ(initial_size, model_->items().size()); 2694 ASSERT_EQ(initial_size, model_->items().size());
2689 } 2695 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698