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

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

Issue 2707133006: Start ARC and sign in after Chrome OS login (Closed)
Patch Set: Start ARC and sign in after Chrome OS login 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_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/arc/arc_util.h"
13 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 13 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" 15 #include "chrome/browser/chromeos/profiles/profile_helper.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.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.h"
18 #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"
19 #include "chromeos/chromeos_switches.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "components/arc/arc_bridge_service.h" 21 #include "components/arc/arc_bridge_service.h"
21 #include "components/arc/arc_service_manager.h" 22 #include "components/arc/arc_service_manager.h"
22 #include "components/arc/arc_session_runner.h" 23 #include "components/arc/arc_session_runner.h"
23 #include "components/arc/arc_util.h" 24 #include "components/arc/arc_util.h"
24 #include "components/arc/test/fake_app_instance.h" 25 #include "components/arc/test/fake_app_instance.h"
25 #include "components/arc/test/fake_arc_session.h" 26 #include "components/arc/test/fake_arc_session.h"
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
27 28
28 namespace { 29 namespace {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 arc::ArcSessionManager::DisableUIForTesting(); 89 arc::ArcSessionManager::DisableUIForTesting();
89 arc_session_manager_->SetProfile(profile_); 90 arc_session_manager_->SetProfile(profile_);
90 arc_session_manager_->StartPreferenceHandler(); 91 arc_session_manager_->StartPreferenceHandler();
91 92
92 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 93 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
93 DCHECK(arc_app_list_pref_); 94 DCHECK(arc_app_list_pref_);
94 base::RunLoop run_loop; 95 base::RunLoop run_loop;
95 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); 96 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure());
96 run_loop.Run(); 97 run_loop.Run();
97 98
98 arc::SetArcPlayStoreEnabledForProfile(profile_, true);
99 // Check initial conditions. 99 // Check initial conditions.
100 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); 100 if (arc::ShouldArcAlwaysStart()) {
101 // When ARC first starts, it runs in opt-out mode of Play Store.
102 EXPECT_TRUE(arc_session_manager_->IsSessionRunning());
103 } else {
104 arc::SetArcPlayStoreEnabledForProfile(profile_, true);
105 EXPECT_FALSE(arc_session_manager_->IsSessionRunning());
106 }
101 107
102 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); 108 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_));
103 arc_service_manager_->arc_bridge_service()->app()->SetInstance( 109 arc_service_manager_->arc_bridge_service()->app()->SetInstance(
104 app_instance_.get()); 110 app_instance_.get());
105 } 111 }
106 112
107 void ArcAppTest::CreateFakeAppsAndPackages() { 113 void ArcAppTest::CreateFakeAppsAndPackages() {
108 arc::mojom::AppInfo app; 114 arc::mojom::AppInfo app;
109 // Make sure we have enough data for test. 115 // Make sure we have enough data for test.
110 for (int i = 0; i < 3; ++i) { 116 for (int i = 0; i < 3; ++i) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 218 }
213 } 219 }
214 220
215 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 221 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
216 for (auto fake_package : fake_packages_) { 222 for (auto fake_package : fake_packages_) {
217 if (package.package_name == fake_package.package_name) 223 if (package.package_name == fake_package.package_name)
218 return true; 224 return true;
219 } 225 }
220 return false; 226 return false;
221 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698