| 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/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" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 base::MakeUnique<arc::ArcPlayStoreEnabledPreferenceHandler>( | 94 base::MakeUnique<arc::ArcPlayStoreEnabledPreferenceHandler>( |
| 95 profile_, arc_session_manager_.get()); | 95 profile_, arc_session_manager_.get()); |
| 96 arc_play_store_enabled_preference_handler_->Start(); | 96 arc_play_store_enabled_preference_handler_->Start(); |
| 97 | 97 |
| 98 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); | 98 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); |
| 99 DCHECK(arc_app_list_pref_); | 99 DCHECK(arc_app_list_pref_); |
| 100 base::RunLoop run_loop; | 100 base::RunLoop run_loop; |
| 101 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); | 101 arc_app_list_pref_->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); |
| 102 run_loop.Run(); | 102 run_loop.Run(); |
| 103 | 103 |
| 104 arc::SetArcPlayStoreEnabledForProfile(profile_, true); | |
| 105 // Check initial conditions. | 104 // Check initial conditions. |
| 106 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); | 105 if (arc::ShouldArcAlwaysStart()) { |
| 106 // When ARC first starts, it runs in opt-out mode of Play Store. |
| 107 EXPECT_TRUE(arc_session_manager_->IsSessionRunning()); |
| 108 } else { |
| 109 arc::SetArcPlayStoreEnabledForProfile(profile_, true); |
| 110 EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); |
| 111 } |
| 107 | 112 |
| 108 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); | 113 app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); |
| 109 arc_service_manager_->arc_bridge_service()->app()->SetInstance( | 114 arc_service_manager_->arc_bridge_service()->app()->SetInstance( |
| 110 app_instance_.get()); | 115 app_instance_.get()); |
| 111 } | 116 } |
| 112 | 117 |
| 113 void ArcAppTest::CreateFakeAppsAndPackages() { | 118 void ArcAppTest::CreateFakeAppsAndPackages() { |
| 114 arc::mojom::AppInfo app; | 119 arc::mojom::AppInfo app; |
| 115 // Make sure we have enough data for test. | 120 // Make sure we have enough data for test. |
| 116 for (int i = 0; i < 3; ++i) { | 121 for (int i = 0; i < 3; ++i) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 224 } |
| 220 } | 225 } |
| 221 | 226 |
| 222 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { | 227 bool ArcAppTest::FindPackage(const arc::mojom::ArcPackageInfo& package) { |
| 223 for (auto fake_package : fake_packages_) { | 228 for (auto fake_package : fake_packages_) { |
| 224 if (package.package_name == fake_package.package_name) | 229 if (package.package_name == fake_package.package_name) |
| 225 return true; | 230 return true; |
| 226 } | 231 } |
| 227 return false; | 232 return false; |
| 228 } | 233 } |
| OLD | NEW |