| OLD | NEW |
| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 auth_service_.reset(new arc::ArcAuthService(bridge_service_.get())); | 110 auth_service_.reset(new arc::ArcAuthService(bridge_service_.get())); |
| 111 DCHECK(arc::ArcAuthService::Get()); | 111 DCHECK(arc::ArcAuthService::Get()); |
| 112 arc::ArcAuthService::DisableUIForTesting(); | 112 arc::ArcAuthService::DisableUIForTesting(); |
| 113 arc_auth_service()->OnPrimaryUserProfilePrepared(profile_); | 113 arc_auth_service()->OnPrimaryUserProfilePrepared(profile_); |
| 114 auth_service_->EnableArc(); | 114 auth_service_->EnableArc(); |
| 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 arc::mojom::AppInstancePtr instance; | 120 bridge_service_->app()->SetInstance(app_instance_.get()); |
| 121 app_instance_->Bind(mojo::GetProxy(&instance)); | |
| 122 bridge_service_->OnAppInstanceReady(std::move(instance)); | |
| 123 app_instance_->WaitForOnAppInstanceReady(); | |
| 124 | 121 |
| 125 // Check initial conditions. | 122 // Check initial conditions. |
| 126 EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get()); | 123 EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get()); |
| 127 EXPECT_TRUE(!arc::ArcBridgeService::Get()->available()); | 124 EXPECT_TRUE(!arc::ArcBridgeService::Get()->available()); |
| 128 EXPECT_FALSE(arc::ArcBridgeService::Get()->ready()); | 125 EXPECT_FALSE(arc::ArcBridgeService::Get()->ready()); |
| 129 | 126 |
| 130 // At this point we should have ArcAppListPrefs as observer of service. | 127 // At this point we should have ArcAppListPrefs as observer of service. |
| 131 EXPECT_TRUE(bridge_service_->HasObserver(arc_app_list_pref_)); | 128 EXPECT_TRUE(bridge_service_->HasObserver(arc_app_list_pref_)); |
| 132 bridge_service()->SetReady(); | 129 bridge_service()->SetReady(); |
| 133 } | 130 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 159 } | 156 } |
| 160 } | 157 } |
| 161 | 158 |
| 162 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { | 159 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { |
| 163 for (auto fake_package : fake_packages_) { | 160 for (auto fake_package : fake_packages_) { |
| 164 if (package.package_name == fake_package.package_name) | 161 if (package.package_name == fake_package.package_name) |
| 165 return true; | 162 return true; |
| 166 } | 163 } |
| 167 return false; | 164 return false; |
| 168 } | 165 } |
| OLD | NEW |