| 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 "ash/common/shelf/shelf_delegate.h" | 5 #include "ash/common/shelf/shelf_delegate.h" |
| 6 #include "ash/common/wm_shell.h" | 6 #include "ash/common/wm_shell.h" |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.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 "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/chromeos/arc/arc_auth_notification.h" |
| 13 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
| 12 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 14 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 13 #include "chrome/browser/chromeos/arc/arc_util.h" | 15 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 14 #include "chrome/browser/extensions/extension_browsertest.h" | 16 #include "chrome/browser/extensions/extension_browsertest.h" |
| 15 #include "chrome/browser/ui/app_list/app_list_service.h" | 17 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 16 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 18 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 17 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 19 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 20 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 19 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 21 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 20 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 22 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
| 21 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 23 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 protected: | 160 protected: |
| 159 // content::BrowserTestBase: | 161 // content::BrowserTestBase: |
| 160 void SetUpCommandLine(base::CommandLine* command_line) override { | 162 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 161 ExtensionBrowserTest::SetUpCommandLine(command_line); | 163 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 162 arc::SetArcAvailableCommandLineForTesting(command_line); | 164 arc::SetArcAvailableCommandLineForTesting(command_line); |
| 163 } | 165 } |
| 164 | 166 |
| 165 void SetUpInProcessBrowserTestFixture() override { | 167 void SetUpInProcessBrowserTestFixture() override { |
| 166 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 168 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 167 arc::ArcSessionManager::DisableUIForTesting(); | 169 arc::ArcSessionManager::DisableUIForTesting(); |
| 170 arc::ArcAuthNotification::DisableForTesting(); |
| 168 } | 171 } |
| 169 | 172 |
| 170 void SetUpOnMainThread() override { | 173 void SetUpOnMainThread() override { |
| 171 arc::SetArcPlayStoreEnabledForProfile(profile(), true); | 174 arc::SetArcPlayStoreEnabledForProfile(profile(), true); |
| 172 } | 175 } |
| 173 | 176 |
| 174 void InstallTestApps(const std::string& package_name, bool multi_app) { | 177 void InstallTestApps(const std::string& package_name, bool multi_app) { |
| 175 app_host()->OnAppListRefreshed(GetTestAppsList(package_name, multi_app)); | 178 app_host()->OnAppListRefreshed(GetTestAppsList(package_name, multi_app)); |
| 176 | 179 |
| 177 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 180 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void SendInstallationFinished(const std::string& package_name, bool success) { | 240 void SendInstallationFinished(const std::string& package_name, bool success) { |
| 238 arc::mojom::InstallationResult result; | 241 arc::mojom::InstallationResult result; |
| 239 result.package_name = package_name; | 242 result.package_name = package_name; |
| 240 result.success = success; | 243 result.success = success; |
| 241 app_host()->OnInstallationFinished( | 244 app_host()->OnInstallationFinished( |
| 242 arc::mojom::InstallationResultPtr(result.Clone())); | 245 arc::mojom::InstallationResultPtr(result.Clone())); |
| 243 base::RunLoop().RunUntilIdle(); | 246 base::RunLoop().RunUntilIdle(); |
| 244 } | 247 } |
| 245 | 248 |
| 246 void StartInstance() { | 249 void StartInstance() { |
| 247 if (arc_session_manager()->profile() != profile()) { | 250 if (arc_session_manager()->profile() != profile()) |
| 248 arc_session_manager()->SetProfile(profile()); | 251 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile()); |
| 249 arc_session_manager()->StartPreferenceHandler(); | |
| 250 } | |
| 251 app_instance_observer()->OnInstanceReady(); | 252 app_instance_observer()->OnInstanceReady(); |
| 252 } | 253 } |
| 253 | 254 |
| 254 void StopInstance() { | 255 void StopInstance() { |
| 255 arc_session_manager()->Shutdown(); | 256 arc_session_manager()->Shutdown(); |
| 256 app_instance_observer()->OnInstanceClosed(); | 257 app_instance_observer()->OnInstanceClosed(); |
| 257 } | 258 } |
| 258 | 259 |
| 259 LauncherItemController* GetAppItemController(const std::string& id) { | 260 LauncherItemController* GetAppItemController(const std::string& id) { |
| 260 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(id); | 261 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(id); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 app_host()->OnTaskDestroyed(2); | 546 app_host()->OnTaskDestroyed(2); |
| 546 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); | 547 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); |
| 547 // Destroy task #2, this kills shelf group 2 | 548 // Destroy task #2, this kills shelf group 2 |
| 548 app_host()->OnTaskDestroyed(3); | 549 app_host()->OnTaskDestroyed(3); |
| 549 EXPECT_FALSE(GetAppItemController(shelf_id2)); | 550 EXPECT_FALSE(GetAppItemController(shelf_id2)); |
| 550 | 551 |
| 551 // Disable ARC, this removes app and as result kills shelf group 3. | 552 // Disable ARC, this removes app and as result kills shelf group 3. |
| 552 arc::SetArcPlayStoreEnabledForProfile(profile(), false); | 553 arc::SetArcPlayStoreEnabledForProfile(profile(), false); |
| 553 EXPECT_FALSE(GetAppItemController(shelf_id3)); | 554 EXPECT_FALSE(GetAppItemController(shelf_id3)); |
| 554 } | 555 } |
| OLD | NEW |