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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.cc

Issue 2711033002: Fix Arc integration test. (Closed)
Patch Set: Pure rebase. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.cc
index e99b5a03e2a0d5374db31469c3d412e4394f5e51..32f7b216620857ad7f03f7f7a5b60678b1273c76 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
@@ -32,6 +33,11 @@ void ArcAppListPrefsFactory::SetFactoryForSyncTest() {
is_sync_test_ = true;
}
+// static
+bool ArcAppListPrefsFactory::IsFactorySetForSyncTest() {
+ return is_sync_test_;
+}
+
void ArcAppListPrefsFactory::RecreateServiceInstanceForTesting(
content::BrowserContext* context) {
Disassociate(context);
@@ -50,16 +56,18 @@ ArcAppListPrefsFactory::~ArcAppListPrefsFactory() {
KeyedService* ArcAppListPrefsFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = static_cast<Profile*>(context);
- if (!arc::IsArcAllowedForProfile(profile))
- return nullptr;
+ // Profiles are always treated as allowed to ARC in sync integration test.
if (is_sync_test_) {
- sync_test_app_instance_holders_[context].reset(
- new arc::InstanceHolder<arc::mojom::AppInstance>());
+ sync_test_app_instance_holders_[context] =
+ base::MakeUnique<arc::InstanceHolder<arc::mojom::AppInstance>>();
return ArcAppListPrefs::Create(
profile, sync_test_app_instance_holders_[context].get());
}
+ if (!arc::IsArcAllowedForProfile(profile))
+ return nullptr;
+
auto* arc_service_manager = arc::ArcServiceManager::Get();
if (!arc_service_manager)
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698