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

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: test coverage in chrome_launcher_controller_impl_unittest.cc 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 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/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"
22 #include "components/arc/arc_util.h" 23 #include "components/arc/arc_util.h"
23 #include "components/arc/test/fake_app_instance.h" 24 #include "components/arc/test/fake_app_instance.h"
24 #include "components/arc/test/fake_arc_session.h" 25 #include "components/arc/test/fake_arc_session.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
26 27
27 namespace { 28 namespace {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Check initial conditions. 97 // Check initial conditions.
98 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); 98 if (arc::ShouldAlwaysStartArc()) {
99 // When ARC first starts, it runs in opt-out mode of Play Store.
100 EXPECT_TRUE(arc_session_manager_->IsSessionRunning());
101 } else {
102 arc_session_manager_->SetArcPlayStoreEnabled(true);
103 EXPECT_FALSE(arc_session_manager_->IsSessionRunning());
104 }
99 105
100 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); 106 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_));
101 arc_service_manager_->arc_bridge_service()->app()->SetInstance( 107 arc_service_manager_->arc_bridge_service()->app()->SetInstance(
102 app_instance_.get()); 108 app_instance_.get());
103 } 109 }
104 110
105 void ArcAppTest::CreateFakeAppsAndPackages() { 111 void ArcAppTest::CreateFakeAppsAndPackages() {
106 arc::mojom::AppInfo app; 112 arc::mojom::AppInfo app;
107 // Make sure we have enough data for test. 113 // Make sure we have enough data for test.
108 for (int i = 0; i < 3; ++i) { 114 for (int i = 0; i < 3; ++i) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 216 }
211 } 217 }
212 218
213 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 219 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
214 for (auto fake_package : fake_packages_) { 220 for (auto fake_package : fake_packages_) {
215 if (package.package_name == fake_package.package_name) 221 if (package.package_name == fake_package.package_name)
216 return true; 222 return true;
217 } 223 }
218 return false; 224 return false;
219 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698