| OLD | NEW |
| 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 Loading... |
| 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |