Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_test.cc

Issue 2574013003: Refactor ArcSessionRunner part 1. (Closed)
Patch Set: rebase to the split CL Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/login/users/fake_chrome_user_manager.h" 12 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
14 #include "chrome/browser/chromeos/profiles/profile_helper.h" 14 #include "chrome/browser/chromeos/profiles/profile_helper.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.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_factory.h" 17 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
18 #include "chromeos/chromeos_switches.h" 18 #include "chromeos/chromeos_switches.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 19 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "components/arc/arc_bridge_service.h" 20 #include "components/arc/arc_bridge_service.h"
21 #include "components/arc/arc_service_manager.h" 21 #include "components/arc/arc_service_manager.h"
22 #include "components/arc/arc_session_runner.h"
22 #include "components/arc/test/fake_app_instance.h" 23 #include "components/arc/test/fake_app_instance.h"
23 #include "components/arc/test/fake_arc_bridge_service.h" 24 #include "components/arc/test/fake_arc_session.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 namespace { 27 namespace {
27 28
28 constexpr char kPackageName1[] = "fake.package.name1"; 29 constexpr char kPackageName1[] = "fake.package.name1";
29 constexpr char kPackageName2[] = "fake.package.name2"; 30 constexpr char kPackageName2[] = "fake.package.name2";
30 constexpr char kPackageName3[] = "fake.package.name3"; 31 constexpr char kPackageName3[] = "fake.package.name3";
31 } 32 }
32 33
33 // static 34 // static
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, 72 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user,
72 profile_); 73 profile_);
73 74
74 // A valid |arc_app_list_prefs_| is needed for the Arc bridge service and the 75 // A valid |arc_app_list_prefs_| is needed for the Arc bridge service and the
75 // Arc auth service. 76 // Arc auth service.
76 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 77 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
77 if (!arc_app_list_pref_) { 78 if (!arc_app_list_pref_) {
78 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( 79 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting(
79 profile_); 80 profile_);
80 } 81 }
81 arc::ArcServiceManager::SetArcBridgeServiceForTesting( 82 arc::ArcServiceManager::SetArcSessionRunnerForTesting(
82 base::MakeUnique<arc::FakeArcBridgeService>()); 83 base::MakeUnique<arc::ArcSessionRunner>(
84 base::Bind(arc::FakeArcSession::Create)));
83 arc_service_manager_ = base::MakeUnique<arc::ArcServiceManager>(nullptr); 85 arc_service_manager_ = base::MakeUnique<arc::ArcServiceManager>(nullptr);
84 arc_session_manager_ = base::MakeUnique<arc::ArcSessionManager>( 86 arc_session_manager_ = base::MakeUnique<arc::ArcSessionManager>(
85 arc_service_manager_->arc_bridge_service()); 87 arc_service_manager_->arc_bridge_service());
86 DCHECK(arc::ArcSessionManager::Get()); 88 DCHECK(arc::ArcSessionManager::Get());
87 arc::ArcSessionManager::DisableUIForTesting(); 89 arc::ArcSessionManager::DisableUIForTesting();
88 arc_session_manager_->OnPrimaryUserProfilePrepared(profile_); 90 arc_session_manager_->OnPrimaryUserProfilePrepared(profile_);
89 91
90 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 92 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
91 DCHECK(arc_app_list_pref_); 93 DCHECK(arc_app_list_pref_);
92 base::RunLoop run_loop; 94 base::RunLoop run_loop;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 212 }
211 } 213 }
212 214
213 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 215 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
214 for (auto fake_package : fake_packages_) { 216 for (auto fake_package : fake_packages_) {
215 if (package.package_name == fake_package.package_name) 217 if (package.package_name == fake_package.package_name)
216 return true; 218 return true;
217 } 219 }
218 return false; 220 return false;
219 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698