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

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

Issue 2723073002: Extract kArcEnabled preference from ArcSessionManager part 2. (Closed)
Patch Set: address comments Created 3 years, 9 months 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_auth_notification.h"
12 #include "chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler. h"
11 #include "chrome/browser/chromeos/arc/arc_session_manager.h" 13 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
12 #include "chrome/browser/chromeos/arc/arc_util.h" 14 #include "chrome/browser/chromeos/arc/arc_util.h"
13 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 15 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
16 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" 20 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 21 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "components/arc/arc_bridge_service.h" 22 #include "components/arc/arc_bridge_service.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (!arc_app_list_pref_) { 81 if (!arc_app_list_pref_) {
80 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( 82 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting(
81 profile_); 83 profile_);
82 } 84 }
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 base::MakeUnique<arc::ArcSessionRunner>( 87 base::MakeUnique<arc::ArcSessionRunner>(
86 base::Bind(arc::FakeArcSession::Create))); 88 base::Bind(arc::FakeArcSession::Create)));
87 DCHECK(arc::ArcSessionManager::Get()); 89 DCHECK(arc::ArcSessionManager::Get());
88 arc::ArcSessionManager::DisableUIForTesting(); 90 arc::ArcSessionManager::DisableUIForTesting();
91 arc::ArcAuthNotification::DisableForTesting();
89 arc_session_manager_->SetProfile(profile_); 92 arc_session_manager_->SetProfile(profile_);
90 arc_session_manager_->StartPreferenceHandler(); 93 arc_play_store_enabled_preference_handler_ =
94 base::MakeUnique<arc::ArcPlayStoreEnabledPreferenceHandler>(
95 profile_, arc_session_manager_.get());
96 arc_play_store_enabled_preference_handler_->Start();
91 97
92 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 98 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
93 DCHECK(arc_app_list_pref_); 99 DCHECK(arc_app_list_pref_);
94 base::RunLoop run_loop; 100 base::RunLoop run_loop;
95 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); 101 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure());
96 run_loop.Run(); 102 run_loop.Run();
97 103
98 arc::SetArcPlayStoreEnabledForProfile(profile_, true); 104 arc::SetArcPlayStoreEnabledForProfile(profile_, true);
99 // Check initial conditions. 105 // Check initial conditions.
100 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); 106 EXPECT_FALSE(arc_session_manager_->IsSessionRunning());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 shortcut_info.intent_uri = 165 shortcut_info.intent_uri =
160 base::StringPrintf("#Intent;fake.shortcut.%d.intent_uri", i); 166 base::StringPrintf("#Intent;fake.shortcut.%d.intent_uri", i);
161 shortcut_info.icon_resource_id = 167 shortcut_info.icon_resource_id =
162 base::StringPrintf("fake.shortcut.%d.icon_resource_id", i); 168 base::StringPrintf("fake.shortcut.%d.icon_resource_id", i);
163 fake_shortcuts_.push_back(shortcut_info); 169 fake_shortcuts_.push_back(shortcut_info);
164 } 170 }
165 } 171 }
166 172
167 void ArcAppTest::TearDown() { 173 void ArcAppTest::TearDown() {
168 app_instance_.reset(); 174 app_instance_.reset();
175 arc_play_store_enabled_preference_handler_.reset();
169 arc_session_manager_.reset(); 176 arc_session_manager_.reset();
170 arc_service_manager_.reset(); 177 arc_service_manager_.reset();
171 if (dbus_thread_manager_initialized_) { 178 if (dbus_thread_manager_initialized_) {
172 // DBusThreadManager may be initialized from other testing utility, 179 // DBusThreadManager may be initialized from other testing utility,
173 // such as ash::test::AshTestHelper::SetUp(), so Shutdown() only when 180 // such as ash::test::AshTestHelper::SetUp(), so Shutdown() only when
174 // it is initialized in ArcAppTest::SetUp(). 181 // it is initialized in ArcAppTest::SetUp().
175 chromeos::DBusThreadManager::Shutdown(); 182 chromeos::DBusThreadManager::Shutdown();
176 dbus_thread_manager_initialized_ = false; 183 dbus_thread_manager_initialized_ = false;
177 } 184 }
178 profile_ = nullptr; 185 profile_ = nullptr;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 219 }
213 } 220 }
214 221
215 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 222 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
216 for (auto fake_package : fake_packages_) { 223 for (auto fake_package : fake_packages_) {
217 if (package.package_name == fake_package.package_name) 224 if (package.package_name == fake_package.package_name)
218 return true; 225 return true;
219 } 226 }
220 return false; 227 return false;
221 } 228 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.h ('k') | chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698