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