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

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

Issue 2106663004: arc: Initial implemetation of Chrome sync for Arc packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify target Created 4 years, 4 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/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 9 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 116 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
117 DCHECK(arc_app_list_pref_); 117 DCHECK(arc_app_list_pref_);
118 118
119 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); 119 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_));
120 bridge_service_->app()->SetInstance(app_instance_.get()); 120 bridge_service_->app()->SetInstance(app_instance_.get());
121 121
122 // Check initial conditions. 122 // Check initial conditions.
123 EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get()); 123 EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get());
124 EXPECT_FALSE(arc::ArcBridgeService::Get()->ready()); 124 EXPECT_FALSE(arc::ArcBridgeService::Get()->ready());
125
126 // At this point we should have ArcAppListPrefs as observer of service.
127 EXPECT_TRUE(bridge_service_->HasObserver(arc_app_list_pref_));
128 bridge_service()->SetReady();
129 } 125 }
130 126
131 void ArcAppTest::TearDown() { 127 void ArcAppTest::TearDown() {
132 auth_service_.reset(); 128 auth_service_.reset();
133 } 129 }
134 130
131 void ArcAppTest::StopArcInstance() {
132 bridge_service_->app()->SetInstance(nullptr);
133 }
134
135 void ArcAppTest::RestartArcInstance() {
136 bridge_service_->app()->SetInstance(nullptr);
137 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_));
138 bridge_service_->app()->SetInstance(app_instance_.get());
139 }
140
135 const user_manager::User* ArcAppTest::CreateUserAndLogin() { 141 const user_manager::User* ArcAppTest::CreateUserAndLogin() {
136 const AccountId account_id(AccountId::FromUserEmailGaiaId( 142 const AccountId account_id(AccountId::FromUserEmailGaiaId(
137 profile_->GetProfileUserName(), "1234567890")); 143 profile_->GetProfileUserName(), "1234567890"));
138 const user_manager::User* user = GetUserManager()->AddUser(account_id); 144 const user_manager::User* user = GetUserManager()->AddUser(account_id);
139 GetUserManager()->LoginUser(account_id); 145 GetUserManager()->LoginUser(account_id);
140 return user; 146 return user;
141 } 147 }
142 148
143 void ArcAppTest::AddPackage(const arc::mojom::ArcPackageInfo& package) { 149 void ArcAppTest::AddPackage(const arc::mojom::ArcPackageInfo& package) {
144 if (!FindPackage(package)) 150 if (!FindPackage(package))
(...skipping 10 matching lines...) Expand all
155 } 161 }
156 } 162 }
157 163
158 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 164 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
159 for (auto fake_package : fake_packages_) { 165 for (auto fake_package : fake_packages_) {
160 if (package.package_name == fake_package.package_name) 166 if (package.package_name == fake_package.package_name)
161 return true; 167 return true;
162 } 168 }
163 return false; 169 return false;
164 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.h ('k') | chrome/browser/ui/app_list/arc/arc_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698