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

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: Test fixed. Created 5 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 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "extensions/common/extension.h" 43 #include "extensions/common/extension.h"
44 #include "extensions/common/manifest_constants.h" 44 #include "extensions/common/manifest_constants.h"
45 #include "testing/gtest/include/gtest/gtest.h" 45 #include "testing/gtest/include/gtest/gtest.h"
46 #include "ui/aura/client/window_tree_client.h" 46 #include "ui/aura/client/window_tree_client.h"
47 #include "ui/base/models/menu_model.h" 47 #include "ui/base/models/menu_model.h"
48 48
49 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
50 #include "ash/test/test_session_state_delegate.h" 50 #include "ash/test/test_session_state_delegate.h"
51 #include "ash/test/test_shell_delegate.h" 51 #include "ash/test/test_shell_delegate.h"
52 #include "chrome/browser/apps/scoped_keep_alive.h" 52 #include "chrome/browser/apps/scoped_keep_alive.h"
53 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 53 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
54 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 54 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
55 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 55 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
56 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 56 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
57 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 57 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
58 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 58 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
59 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.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_chromeos.h" 60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
61 #include "chrome/common/chrome_constants.h" 61 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_switches.h" 62 #include "chrome/common/chrome_switches.h"
63 #include "chrome/test/base/testing_browser_process.h" 63 #include "chrome/test/base/testing_browser_process.h"
64 #include "chrome/test/base/testing_profile_manager.h" 64 #include "chrome/test/base/testing_profile_manager.h"
65 #include "components/user_manager/fake_user_manager.h"
65 #include "content/public/browser/web_contents_observer.h" 66 #include "content/public/browser/web_contents_observer.h"
66 #include "content/public/test/test_utils.h" 67 #include "content/public/test/test_utils.h"
67 #include "extensions/browser/app_window/app_window_contents.h" 68 #include "extensions/browser/app_window/app_window_contents.h"
68 #include "extensions/browser/app_window/app_window_registry.h" 69 #include "extensions/browser/app_window/app_window_registry.h"
69 #include "extensions/browser/app_window/native_app_window.h" 70 #include "extensions/browser/app_window/native_app_window.h"
70 #include "ui/aura/window.h" 71 #include "ui/aura/window.h"
71 #endif 72 #endif
72 73
73 using base::ASCIIToUTF16; 74 using base::ASCIIToUTF16;
74 using extensions::Extension; 75 using extensions::Extension;
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 void SetUp() override { 773 void SetUp() override {
773 profile_manager_.reset( 774 profile_manager_.reset(
774 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 775 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
775 776
776 ASSERT_TRUE(profile_manager_->SetUp()); 777 ASSERT_TRUE(profile_manager_->SetUp());
777 778
778 // AvatarMenu and multiple profiles works after user logged in. 779 // AvatarMenu and multiple profiles works after user logged in.
779 profile_manager_->SetLoggedIn(true); 780 profile_manager_->SetLoggedIn(true);
780 781
781 // Initialize the UserManager singleton to a fresh FakeUserManager instance. 782 // Initialize the UserManager singleton to a fresh FakeUserManager instance.
782 user_manager_enabler_.reset( 783 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler(
783 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); 784 new chromeos::FakeChromeUserManager));
784 785
785 // Initialize the rest. 786 // Initialize the rest.
786 ChromeLauncherControllerTest::SetUp(); 787 ChromeLauncherControllerTest::SetUp();
787 788
788 // Get some base objects. 789 // Get some base objects.
789 session_delegate()->set_logged_in_users(2); 790 session_delegate()->set_logged_in_users(2);
790 shell_delegate_ = static_cast<ash::test::TestShellDelegate*>( 791 shell_delegate_ = static_cast<ash::test::TestShellDelegate*>(
791 ash::Shell::GetInstance()->delegate()); 792 ash::Shell::GetInstance()->delegate());
792 shell_delegate_->set_multi_profiles_enabled(true); 793 shell_delegate_->set_multi_profiles_enabled(true);
793 } 794 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 ProfileToNameMap::iterator it = created_profiles_.find(profile); 900 ProfileToNameMap::iterator it = created_profiles_.find(profile);
900 DCHECK(it != created_profiles_.end()); 901 DCHECK(it != created_profiles_.end());
901 profile_manager_->DeleteTestingProfile(it->second); 902 profile_manager_->DeleteTestingProfile(it->second);
902 created_profiles_.erase(it); 903 created_profiles_.erase(it);
903 } 904 }
904 905
905 private: 906 private:
906 typedef std::map<Profile*, std::string> ProfileToNameMap; 907 typedef std::map<Profile*, std::string> ProfileToNameMap;
907 TestingProfileManager* profile_manager() { return profile_manager_.get(); } 908 TestingProfileManager* profile_manager() { return profile_manager_.get(); }
908 909
909 chromeos::FakeUserManager* GetFakeUserManager() { 910 chromeos::FakeChromeUserManager* GetFakeUserManager() {
910 return static_cast<chromeos::FakeUserManager*>( 911 return static_cast<chromeos::FakeChromeUserManager*>(
911 user_manager::UserManager::Get()); 912 user_manager::UserManager::Get());
912 } 913 }
913 914
914 scoped_ptr<TestingProfileManager> profile_manager_; 915 scoped_ptr<TestingProfileManager> profile_manager_;
915 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; 916 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
916 917
917 ash::test::TestShellDelegate* shell_delegate_; 918 ash::test::TestShellDelegate* shell_delegate_;
918 919
919 ProfileToNameMap created_profiles_; 920 ProfileToNameMap created_profiles_;
920 921
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 2678
2678 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2679 EXPECT_EQ(1, app_icon_loader->fetch_count());
2679 ASSERT_EQ(initial_size + 1, model_->items().size()); 2680 ASSERT_EQ(initial_size + 1, model_->items().size());
2680 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2681 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2681 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2682 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2682 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2683 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2683 2684
2684 launcher_controller_->UnpinAppWithID("1"); 2685 launcher_controller_->UnpinAppWithID("1");
2685 ASSERT_EQ(initial_size, model_->items().size()); 2686 ASSERT_EQ(initial_size, model_->items().size());
2686 } 2687 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/browser/ui/ash/session_state_delegate_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698