Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc

Issue 2550683002: [Merge to 2924] Reland "Propagate information about how ARC apps are launched" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 StartInstance(); 249 StartInstance();
249 app_info = app_prefs()->GetApp(app_id); 250 app_info = app_prefs()->GetApp(app_id);
250 ASSERT_TRUE(app_info); 251 ASSERT_TRUE(app_info);
251 EXPECT_FALSE(app_info->ready); 252 EXPECT_FALSE(app_info->ready);
252 if (is_pinned()) 253 if (is_pinned())
253 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); 254 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id));
254 else 255 else
255 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id)); 256 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id));
256 257
257 // Launching non-ready Arc app creates item on shelf and spinning animation. 258 // Launching non-ready Arc app creates item on shelf and spinning animation.
258 arc::LaunchApp(profile(), app_id); 259 arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON);
259 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); 260 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id));
260 AppAnimatedWaiter(app_id).Wait(); 261 AppAnimatedWaiter(app_id).Wait();
261 262
262 switch (test_action()) { 263 switch (test_action()) {
263 case TEST_ACTION_START: 264 case TEST_ACTION_START:
264 // Now simulates that Arc is started and app list is refreshed. This 265 // Now simulates that Arc is started and app list is refreshed. This
265 // should stop animation and delete icon from the shelf. 266 // should stop animation and delete icon from the shelf.
266 InstallTestApps(false); 267 InstallTestApps(false);
267 SendPackageAdded(false); 268 SendPackageAdded(false);
268 EXPECT_TRUE(chrome_controller() 269 EXPECT_TRUE(chrome_controller()
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // Test AppListControllerDelegate::IsAppOpen for Arc apps. 367 // Test AppListControllerDelegate::IsAppOpen for Arc apps.
367 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, IsAppOpen) { 368 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, IsAppOpen) {
368 StartInstance(); 369 StartInstance();
369 InstallTestApps(false); 370 InstallTestApps(false);
370 SendPackageAdded(true); 371 SendPackageAdded(true);
371 const std::string app_id = GetTestApp1Id(); 372 const std::string app_id = GetTestApp1Id();
372 373
373 AppListService* service = AppListService::Get(); 374 AppListService* service = AppListService::Get();
374 AppListControllerDelegate* delegate = service->GetControllerDelegate(); 375 AppListControllerDelegate* delegate = service->GetControllerDelegate();
375 EXPECT_FALSE(delegate->IsAppOpen(app_id)); 376 EXPECT_FALSE(delegate->IsAppOpen(app_id));
376 arc::LaunchApp(profile(), app_id); 377 arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON);
377 EXPECT_FALSE(delegate->IsAppOpen(app_id)); 378 EXPECT_FALSE(delegate->IsAppOpen(app_id));
378 // Simulate task creation so the app is marked as running/open. 379 // Simulate task creation so the app is marked as running/open.
379 std::unique_ptr<ArcAppListPrefs::AppInfo> info = app_prefs()->GetApp(app_id); 380 std::unique_ptr<ArcAppListPrefs::AppInfo> info = app_prefs()->GetApp(app_id);
380 app_host()->OnTaskCreated(0, info->package_name, info->activity, info->name); 381 app_host()->OnTaskCreated(0, info->package_name, info->activity, info->name);
381 EXPECT_TRUE(delegate->IsAppOpen(app_id)); 382 EXPECT_TRUE(delegate->IsAppOpen(app_id));
382 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698