| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "ash/ash_switches.h" | 16 #include "ash/ash_switches.h" |
| 17 #include "ash/shelf/shelf_item_delegate_manager.h" | 17 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 18 #include "ash/shelf/shelf_model.h" | 18 #include "ash/shelf/shelf_model.h" |
| 19 #include "ash/shelf/shelf_model_observer.h" | 19 #include "ash/shelf/shelf_model_observer.h" |
| 20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 21 #include "ash/test/shelf_item_delegate_manager_test_api.h" | 21 #include "ash/test/shelf_item_delegate_manager_test_api.h" |
| 22 #include "ash/test/test_session_state_delegate.h" | 22 #include "ash/test/test_session_state_delegate.h" |
| 23 #include "ash/test/test_shell_delegate.h" | 23 #include "ash/test/test_shell_delegate.h" |
| 24 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 25 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
| 26 #include "base/files/file_path.h" | 26 #include "base/files/file_path.h" |
| 27 #include "base/location.h" |
| 27 #include "base/macros.h" | 28 #include "base/macros.h" |
| 28 #include "base/memory/ptr_util.h" | 29 #include "base/memory/ptr_util.h" |
| 29 #include "base/message_loop/message_loop.h" | 30 #include "base/message_loop/message_loop.h" |
| 31 #include "base/single_thread_task_runner.h" |
| 30 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
| 33 #include "base/threading/thread_task_runner_handle.h" |
| 31 #include "base/values.h" | 34 #include "base/values.h" |
| 32 #include "build/build_config.h" | 35 #include "build/build_config.h" |
| 33 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 36 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 34 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 37 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 35 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 38 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 36 #include "chrome/browser/extensions/extension_service.h" | 39 #include "chrome/browser/extensions/extension_service.h" |
| 37 #include "chrome/browser/extensions/test_extension_system.h" | 40 #include "chrome/browser/extensions/test_extension_system.h" |
| 38 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 41 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 39 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 42 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 40 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" | 43 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 void TearDown() override { | 864 void TearDown() override { |
| 862 ChromeLauncherControllerTest::TearDown(); | 865 ChromeLauncherControllerTest::TearDown(); |
| 863 user_manager_enabler_.reset(); | 866 user_manager_enabler_.reset(); |
| 864 for (ProfileToNameMap::iterator it = created_profiles_.begin(); | 867 for (ProfileToNameMap::iterator it = created_profiles_.begin(); |
| 865 it != created_profiles_.end(); ++it) | 868 it != created_profiles_.end(); ++it) |
| 866 profile_manager_->DeleteTestingProfile(it->second); | 869 profile_manager_->DeleteTestingProfile(it->second); |
| 867 chromeos::WallpaperManager::Shutdown(); | 870 chromeos::WallpaperManager::Shutdown(); |
| 868 | 871 |
| 869 // A Task is leaked if we don't destroy everything, then run the message | 872 // A Task is leaked if we don't destroy everything, then run the message |
| 870 // loop. | 873 // loop. |
| 871 base::MessageLoop::current()->PostTask( | 874 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 872 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 875 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 873 base::MessageLoop::current()->Run(); | 876 base::MessageLoop::current()->Run(); |
| 874 } | 877 } |
| 875 | 878 |
| 876 // Creates a profile for a given |user_name|. Note that this class will keep | 879 // Creates a profile for a given |user_name|. Note that this class will keep |
| 877 // the ownership of the created object. | 880 // the ownership of the created object. |
| 878 TestingProfile* CreateMultiUserProfile(const std::string& user_name) { | 881 TestingProfile* CreateMultiUserProfile(const std::string& user_name) { |
| 879 const std::string email_string = user_name + "@example.com"; | 882 const std::string email_string = user_name + "@example.com"; |
| 880 const AccountId account_id(AccountId::FromUserEmail(email_string)); | 883 const AccountId account_id(AccountId::FromUserEmail(email_string)); |
| 881 static_cast<ash::test::TestSessionStateDelegate*>( | 884 static_cast<ash::test::TestSessionStateDelegate*>( |
| (...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3068 // by hash we can determine that appropriate package was set by policy. | 3071 // by hash we can determine that appropriate package was set by policy. |
| 3069 base::ListValue policy_value; | 3072 base::ListValue policy_value; |
| 3070 InsertPrefValue(&policy_value, 0, appinfo.package_name); | 3073 InsertPrefValue(&policy_value, 0, appinfo.package_name); |
| 3071 profile()->GetTestingPrefService()->SetManagedPref( | 3074 profile()->GetTestingPrefService()->SetManagedPref( |
| 3072 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); | 3075 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); |
| 3073 | 3076 |
| 3074 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); | 3077 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); |
| 3075 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 3078 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 3076 launcher_controller_->GetPinnable(app_id)); | 3079 launcher_controller_->GetPinnable(app_id)); |
| 3077 } | 3080 } |
| OLD | NEW |