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

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

Issue 2138513002: arc: Use the new InstanceHolder for unittests (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@bridge_refactor_first
Patch Set: Rebase Created 4 years, 5 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 auth_service_.reset(new arc::ArcAuthService(bridge_service_.get())); 103 auth_service_.reset(new arc::ArcAuthService(bridge_service_.get()));
104 DCHECK(arc::ArcAuthService::Get()); 104 DCHECK(arc::ArcAuthService::Get());
105 arc::ArcAuthService::DisableUIForTesting(); 105 arc::ArcAuthService::DisableUIForTesting();
106 arc_auth_service()->OnPrimaryUserProfilePrepared(profile_); 106 arc_auth_service()->OnPrimaryUserProfilePrepared(profile_);
107 auth_service_->EnableArc(); 107 auth_service_->EnableArc();
108 108
109 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 109 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
110 DCHECK(arc_app_list_pref_); 110 DCHECK(arc_app_list_pref_);
111 111
112 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); 112 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_));
113 arc::mojom::AppInstancePtr instance; 113 bridge_service_->app()->SetInstance(app_instance_.get());
114 app_instance_->Bind(mojo::GetProxy(&instance));
115 bridge_service_->OnAppInstanceReady(std::move(instance));
116 app_instance_->WaitForOnAppInstanceReady();
117 114
118 // Check initial conditions. 115 // Check initial conditions.
119 EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get()); 116 EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get());
120 EXPECT_TRUE(!arc::ArcBridgeService::Get()->available()); 117 EXPECT_TRUE(!arc::ArcBridgeService::Get()->available());
121 EXPECT_FALSE(arc::ArcBridgeService::Get()->ready()); 118 EXPECT_FALSE(arc::ArcBridgeService::Get()->ready());
122 119
123 // At this point we should have ArcAppListPrefs as observer of service. 120 // At this point we should have ArcAppListPrefs as observer of service.
124 EXPECT_TRUE(bridge_service_->HasObserver(arc_app_list_pref_)); 121 EXPECT_TRUE(bridge_service_->HasObserver(arc_app_list_pref_));
125 bridge_service()->SetReady(); 122 bridge_service()->SetReady();
126 } 123 }
(...skipping 24 matching lines...) Expand all
151 } 148 }
152 } 149 }
153 150
154 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { 151 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) {
155 for (auto fake_package : fake_packages_) { 152 for (auto fake_package : fake_packages_) {
156 if (package.package_name == fake_package.package_name) 153 if (package.package_name == fake_package.package_name)
157 return true; 154 return true;
158 } 155 }
159 return false; 156 return false;
160 } 157 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_context_menu_unittest.cc ('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