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

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

Issue 2648213004: Migrate --enable-arc and --arc-available part 1. (Closed)
Patch Set: address comments. 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"
19 #include "chromeos/dbus/dbus_thread_manager.h" 18 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "components/arc/arc_bridge_service.h" 19 #include "components/arc/arc_bridge_service.h"
21 #include "components/arc/arc_service_manager.h" 20 #include "components/arc/arc_service_manager.h"
22 #include "components/arc/arc_session_runner.h" 21 #include "components/arc/arc_session_runner.h"
22 #include "components/arc/arc_util.h"
23 #include "components/arc/test/fake_app_instance.h" 23 #include "components/arc/test/fake_app_instance.h"
24 #include "components/arc/test/fake_arc_session.h" 24 #include "components/arc/test/fake_arc_session.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 namespace { 27 namespace {
28 28
29 constexpr char kPackageName1[] = "fake.package.name1"; 29 constexpr char kPackageName1[] = "fake.package.name1";
30 constexpr char kPackageName2[] = "fake.package.name2"; 30 constexpr char kPackageName2[] = "fake.package.name2";
31 constexpr char kPackageName3[] = "fake.package.name3"; 31 constexpr char kPackageName3[] = "fake.package.name3";
32 } 32 }
(...skipping 20 matching lines...) Expand all
53 chromeos::FakeChromeUserManager* ArcAppTest::GetUserManager() { 53 chromeos::FakeChromeUserManager* ArcAppTest::GetUserManager() {
54 return static_cast<chromeos::FakeChromeUserManager*>( 54 return static_cast<chromeos::FakeChromeUserManager*>(
55 user_manager::UserManager::Get()); 55 user_manager::UserManager::Get());
56 } 56 }
57 57
58 void ArcAppTest::SetUp(Profile* profile) { 58 void ArcAppTest::SetUp(Profile* profile) {
59 if (!chromeos::DBusThreadManager::IsInitialized()) { 59 if (!chromeos::DBusThreadManager::IsInitialized()) {
60 chromeos::DBusThreadManager::Initialize(); 60 chromeos::DBusThreadManager::Initialize();
61 dbus_thread_manager_initialized_ = true; 61 dbus_thread_manager_initialized_ = true;
62 } 62 }
63 base::CommandLine::ForCurrentProcess()->AppendSwitch( 63 arc::SetArcAvailableCommandLineForTesting(
64 chromeos::switches::kEnableArc); 64 base::CommandLine::ForCurrentProcess());
65 DCHECK(!profile_); 65 DCHECK(!profile_);
66 profile_ = profile; 66 profile_ = profile;
67 const user_manager::User* user = CreateUserAndLogin(); 67 const user_manager::User* user = CreateUserAndLogin();
68 68
69 // If for any reason the garbage collector kicks in while we are waiting for 69 // If for any reason the garbage collector kicks in while we are waiting for
70 // an icon, have the user-to-profile mapping ready to avoid using the real 70 // an icon, have the user-to-profile mapping ready to avoid using the real
71 // profile manager (which is null). 71 // profile manager (which is null).
72 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, 72 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user,
73 profile_); 73 profile_);
74 74
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 } 211 }
212 212
213 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 213 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
214 for (auto fake_package : fake_packages_) { 214 for (auto fake_package : fake_packages_) {
215 if (package.package_name == fake_package.package_name) 215 if (package.package_name == fake_package.package_name)
216 return true; 216 return true;
217 } 217 }
218 return false; 218 return false;
219 } 219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698