| 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 "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| 11 #include "chrome/browser/ui/app_list/app_list_service.h" | 11 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 12 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 13 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 13 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 15 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 15 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 16 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 16 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
| 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 18 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 18 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 19 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
| 20 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
| 21 #include "mojo/common/common_type_converters.h" | 21 #include "mojo/common/common_type_converters.h" |
| 22 #include "ui/events/event_constants.h" |
| 22 | 23 |
| 23 namespace mojo { | 24 namespace mojo { |
| 24 | 25 |
| 25 template <> | 26 template <> |
| 26 struct TypeConverter<arc::mojom::AppInfoPtr, arc::mojom::AppInfo> { | 27 struct TypeConverter<arc::mojom::AppInfoPtr, arc::mojom::AppInfo> { |
| 27 static arc::mojom::AppInfoPtr Convert(const arc::mojom::AppInfo& app_info) { | 28 static arc::mojom::AppInfoPtr Convert(const arc::mojom::AppInfo& app_info) { |
| 28 return app_info.Clone(); | 29 return app_info.Clone(); |
| 29 } | 30 } |
| 30 }; | 31 }; |
| 31 | 32 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 StartInstance(); | 253 StartInstance(); |
| 253 app_info = app_prefs()->GetApp(app_id); | 254 app_info = app_prefs()->GetApp(app_id); |
| 254 ASSERT_TRUE(app_info); | 255 ASSERT_TRUE(app_info); |
| 255 EXPECT_FALSE(app_info->ready); | 256 EXPECT_FALSE(app_info->ready); |
| 256 if (is_pinned()) | 257 if (is_pinned()) |
| 257 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); | 258 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); |
| 258 else | 259 else |
| 259 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id)); | 260 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id)); |
| 260 | 261 |
| 261 // Launching non-ready Arc app creates item on shelf and spinning animation. | 262 // Launching non-ready Arc app creates item on shelf and spinning animation. |
| 262 arc::LaunchApp(profile(), app_id); | 263 arc::LaunchApp(profile(), app_id, ui::EF_NONE); |
| 263 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); | 264 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); |
| 264 AppAnimatedWaiter(app_id).Wait(); | 265 AppAnimatedWaiter(app_id).Wait(); |
| 265 | 266 |
| 266 switch (test_action()) { | 267 switch (test_action()) { |
| 267 case TEST_ACTION_START: | 268 case TEST_ACTION_START: |
| 268 // Now simulates that Arc is started and app list is refreshed. This | 269 // Now simulates that Arc is started and app list is refreshed. This |
| 269 // should stop animation and delete icon from the shelf. | 270 // should stop animation and delete icon from the shelf. |
| 270 InstallTestApps(false); | 271 InstallTestApps(false); |
| 271 SendPackageAdded(false); | 272 SendPackageAdded(false); |
| 272 EXPECT_TRUE(chrome_controller() | 273 EXPECT_TRUE(chrome_controller() |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // Test AppListControllerDelegate::IsAppOpen for Arc apps. | 371 // Test AppListControllerDelegate::IsAppOpen for Arc apps. |
| 371 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, IsAppOpen) { | 372 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, IsAppOpen) { |
| 372 StartInstance(); | 373 StartInstance(); |
| 373 InstallTestApps(false); | 374 InstallTestApps(false); |
| 374 SendPackageAdded(true); | 375 SendPackageAdded(true); |
| 375 const std::string app_id = GetTestApp1Id(); | 376 const std::string app_id = GetTestApp1Id(); |
| 376 | 377 |
| 377 AppListService* service = AppListService::Get(); | 378 AppListService* service = AppListService::Get(); |
| 378 AppListControllerDelegate* delegate = service->GetControllerDelegate(); | 379 AppListControllerDelegate* delegate = service->GetControllerDelegate(); |
| 379 EXPECT_FALSE(delegate->IsAppOpen(app_id)); | 380 EXPECT_FALSE(delegate->IsAppOpen(app_id)); |
| 380 arc::LaunchApp(profile(), app_id); | 381 arc::LaunchApp(profile(), app_id, ui::EF_NONE); |
| 381 EXPECT_FALSE(delegate->IsAppOpen(app_id)); | 382 EXPECT_FALSE(delegate->IsAppOpen(app_id)); |
| 382 // Simulate task creation so the app is marked as running/open. | 383 // Simulate task creation so the app is marked as running/open. |
| 383 std::unique_ptr<ArcAppListPrefs::AppInfo> info = app_prefs()->GetApp(app_id); | 384 std::unique_ptr<ArcAppListPrefs::AppInfo> info = app_prefs()->GetApp(app_id); |
| 384 app_host()->OnTaskCreated(0, info->package_name, info->activity, info->name); | 385 app_host()->OnTaskCreated(0, info->package_name, info->activity, info->name); |
| 385 EXPECT_TRUE(delegate->IsAppOpen(app_id)); | 386 EXPECT_TRUE(delegate->IsAppOpen(app_id)); |
| 386 } | 387 } |
| OLD | NEW |