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_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ash/test/ash_test_helper.h" | 24 #include "ash/test/ash_test_helper.h" |
25 #include "ash/test/test_session_state_delegate.h" | 25 #include "ash/test/test_session_state_delegate.h" |
26 #include "ash/test/test_shell_delegate.h" | 26 #include "ash/test/test_shell_delegate.h" |
27 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
28 #include "base/command_line.h" | 28 #include "base/command_line.h" |
29 #include "base/compiler_specific.h" | 29 #include "base/compiler_specific.h" |
30 #include "base/files/file_path.h" | 30 #include "base/files/file_path.h" |
31 #include "base/location.h" | 31 #include "base/location.h" |
32 #include "base/macros.h" | 32 #include "base/macros.h" |
33 #include "base/memory/ptr_util.h" | 33 #include "base/memory/ptr_util.h" |
34 #include "base/message_loop/message_loop.h" | 34 #include "base/run_loop.h" |
35 #include "base/single_thread_task_runner.h" | 35 #include "base/single_thread_task_runner.h" |
36 #include "base/strings/utf_string_conversions.h" | 36 #include "base/strings/utf_string_conversions.h" |
37 #include "base/threading/thread_task_runner_handle.h" | |
38 #include "base/values.h" | 37 #include "base/values.h" |
39 #include "build/build_config.h" | 38 #include "build/build_config.h" |
40 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 39 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
41 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 40 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
42 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 41 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
43 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 42 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
44 #include "chrome/browser/extensions/extension_service.h" | 43 #include "chrome/browser/extensions/extension_service.h" |
45 #include "chrome/browser/extensions/test_extension_system.h" | 44 #include "chrome/browser/extensions/test_extension_system.h" |
46 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 45 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
47 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 46 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 void TearDown() override { | 1097 void TearDown() override { |
1099 ChromeLauncherControllerImplTest::TearDown(); | 1098 ChromeLauncherControllerImplTest::TearDown(); |
1100 user_manager_enabler_.reset(); | 1099 user_manager_enabler_.reset(); |
1101 for (ProfileToNameMap::iterator it = created_profiles_.begin(); | 1100 for (ProfileToNameMap::iterator it = created_profiles_.begin(); |
1102 it != created_profiles_.end(); ++it) | 1101 it != created_profiles_.end(); ++it) |
1103 profile_manager_->DeleteTestingProfile(it->second); | 1102 profile_manager_->DeleteTestingProfile(it->second); |
1104 chromeos::WallpaperManager::Shutdown(); | 1103 chromeos::WallpaperManager::Shutdown(); |
1105 | 1104 |
1106 // A Task is leaked if we don't destroy everything, then run the message | 1105 // A Task is leaked if we don't destroy everything, then run the message |
1107 // loop. | 1106 // loop. |
1108 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1107 base::RunLoop().RunUntilIdle(); |
1109 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | |
1110 base::MessageLoop::current()->Run(); | |
1111 } | 1108 } |
1112 | 1109 |
1113 // Creates a profile for a given |user_name|. Note that this class will keep | 1110 // Creates a profile for a given |user_name|. Note that this class will keep |
1114 // the ownership of the created object. | 1111 // the ownership of the created object. |
1115 TestingProfile* CreateMultiUserProfile(const std::string& user_name) { | 1112 TestingProfile* CreateMultiUserProfile(const std::string& user_name) { |
1116 const std::string email_string = user_name + "@example.com"; | 1113 const std::string email_string = user_name + "@example.com"; |
1117 const AccountId account_id(AccountId::FromUserEmail(email_string)); | 1114 const AccountId account_id(AccountId::FromUserEmail(email_string)); |
1118 ash::test::AshTestHelper::GetTestSessionStateDelegate()->AddUser( | 1115 ash::test::AshTestHelper::GetTestSessionStateDelegate()->AddUser( |
1119 account_id); | 1116 account_id); |
1120 // Add a user to the fake user manager. | 1117 // Add a user to the fake user manager. |
(...skipping 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3909 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); | 3906 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); |
3910 | 3907 |
3911 std::string window_app_id("org.chromium.arc.1"); | 3908 std::string window_app_id("org.chromium.arc.1"); |
3912 CreateArcWindow(window_app_id); | 3909 CreateArcWindow(window_app_id); |
3913 arc_test_.app_instance()->SendTaskCreated(1, | 3910 arc_test_.app_instance()->SendTaskCreated(1, |
3914 arc_test_.fake_default_apps()[0]); | 3911 arc_test_.fake_default_apps()[0]); |
3915 | 3912 |
3916 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); | 3913 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
3917 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); | 3914 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); |
3918 } | 3915 } |
OLD | NEW |