| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app_list/arc/arc_app_test.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 11 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 12 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 12 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 13 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 17 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 17 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" | 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" |
| 18 #include "chromeos/dbus/dbus_thread_manager.h" | 19 #include "chromeos/dbus/dbus_thread_manager.h" |
| 19 #include "components/arc/arc_bridge_service.h" | 20 #include "components/arc/arc_bridge_service.h" |
| 20 #include "components/arc/arc_service_manager.h" | 21 #include "components/arc/arc_service_manager.h" |
| 21 #include "components/arc/arc_session_runner.h" | 22 #include "components/arc/arc_session_runner.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 DCHECK(arc::ArcSessionManager::Get()); | 87 DCHECK(arc::ArcSessionManager::Get()); |
| 87 arc::ArcSessionManager::DisableUIForTesting(); | 88 arc::ArcSessionManager::DisableUIForTesting(); |
| 88 arc_session_manager_->OnPrimaryUserProfilePrepared(profile_); | 89 arc_session_manager_->OnPrimaryUserProfilePrepared(profile_); |
| 89 | 90 |
| 90 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); | 91 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); |
| 91 DCHECK(arc_app_list_pref_); | 92 DCHECK(arc_app_list_pref_); |
| 92 base::RunLoop run_loop; | 93 base::RunLoop run_loop; |
| 93 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); | 94 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); |
| 94 run_loop.Run(); | 95 run_loop.Run(); |
| 95 | 96 |
| 96 arc_session_manager_->SetArcPlayStoreEnabled(true); | 97 arc::SetArcPlayStoreEnabledForProfile(profile_, true); |
| 97 // Check initial conditions. | 98 // Check initial conditions. |
| 98 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); | 99 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); |
| 99 | 100 |
| 100 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); | 101 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); |
| 101 arc_service_manager_->arc_bridge_service()->app()->SetInstance( | 102 arc_service_manager_->arc_bridge_service()->app()->SetInstance( |
| 102 app_instance_.get()); | 103 app_instance_.get()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void ArcAppTest::CreateFakeAppsAndPackages() { | 106 void ArcAppTest::CreateFakeAppsAndPackages() { |
| 106 arc::mojom::AppInfo app; | 107 arc::mojom::AppInfo app; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 211 } |
| 211 } | 212 } |
| 212 | 213 |
| 213 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { | 214 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { |
| 214 for (auto fake_package : fake_packages_) { | 215 for (auto fake_package : fake_packages_) { |
| 215 if (package.package_name == fake_package.package_name) | 216 if (package.package_name == fake_package.package_name) |
| 216 return true; | 217 return true; |
| 217 } | 218 } |
| 218 return false; | 219 return false; |
| 219 } | 220 } |
| OLD | NEW |