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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_chrome_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/chromeos/login/users/wallpaper/wallpaper_manager.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" |
64 #include "chrome/test/base/testing_profile_manager.h" | 65 #include "chrome/test/base/testing_profile_manager.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 777 |
777 ASSERT_TRUE(profile_manager_->SetUp()); | 778 ASSERT_TRUE(profile_manager_->SetUp()); |
778 | 779 |
779 // AvatarMenu and multiple profiles works after user logged in. | 780 // AvatarMenu and multiple profiles works after user logged in. |
780 profile_manager_->SetLoggedIn(true); | 781 profile_manager_->SetLoggedIn(true); |
781 | 782 |
782 // Initialize the UserManager singleton to a fresh FakeUserManager instance. | 783 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
783 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( | 784 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( |
784 new chromeos::FakeChromeUserManager)); | 785 new chromeos::FakeChromeUserManager)); |
785 | 786 |
| 787 // Initialize the WallpaperManager singleton. |
| 788 chromeos::WallpaperManager::Initialize(); |
| 789 |
786 // Initialize the rest. | 790 // Initialize the rest. |
787 ChromeLauncherControllerTest::SetUp(); | 791 ChromeLauncherControllerTest::SetUp(); |
788 | 792 |
789 // Get some base objects. | 793 // Get some base objects. |
790 session_delegate()->set_logged_in_users(2); | 794 session_delegate()->set_logged_in_users(2); |
791 shell_delegate_ = static_cast<ash::test::TestShellDelegate*>( | 795 shell_delegate_ = static_cast<ash::test::TestShellDelegate*>( |
792 ash::Shell::GetInstance()->delegate()); | 796 ash::Shell::GetInstance()->delegate()); |
793 shell_delegate_->set_multi_profiles_enabled(true); | 797 shell_delegate_->set_multi_profiles_enabled(true); |
794 } | 798 } |
795 | 799 |
796 void TearDown() override { | 800 void TearDown() override { |
797 ChromeLauncherControllerTest::TearDown(); | 801 ChromeLauncherControllerTest::TearDown(); |
798 user_manager_enabler_.reset(); | 802 user_manager_enabler_.reset(); |
799 for (ProfileToNameMap::iterator it = created_profiles_.begin(); | 803 for (ProfileToNameMap::iterator it = created_profiles_.begin(); |
800 it != created_profiles_.end(); ++it) | 804 it != created_profiles_.end(); ++it) |
801 profile_manager_->DeleteTestingProfile(it->second); | 805 profile_manager_->DeleteTestingProfile(it->second); |
| 806 chromeos::WallpaperManager::Shutdown(); |
802 | 807 |
803 // A Task is leaked if we don't destroy everything, then run the message | 808 // A Task is leaked if we don't destroy everything, then run the message |
804 // loop. | 809 // loop. |
805 base::MessageLoop::current()->PostTask(FROM_HERE, | 810 base::MessageLoop::current()->PostTask(FROM_HERE, |
806 base::MessageLoop::QuitClosure()); | 811 base::MessageLoop::QuitClosure()); |
807 base::MessageLoop::current()->Run(); | 812 base::MessageLoop::current()->Run(); |
808 } | 813 } |
809 | 814 |
810 // Creates a profile for a given |user_name|. Note that this class will keep | 815 // Creates a profile for a given |user_name|. Note that this class will keep |
811 // the ownership of the created object. | 816 // the ownership of the created object. |
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 | 2683 |
2679 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2684 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
2680 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2685 ASSERT_EQ(initial_size + 1, model_->items().size()); |
2681 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2686 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
2682 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2687 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
2683 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2688 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
2684 | 2689 |
2685 launcher_controller_->UnpinAppWithID("1"); | 2690 launcher_controller_->UnpinAppWithID("1"); |
2686 ASSERT_EQ(initial_size, model_->items().size()); | 2691 ASSERT_EQ(initial_size, model_->items().size()); |
2687 } | 2692 } |
OLD | NEW |