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

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

Issue 2627533002: Replace ShelfItemDelegate::GetTitle() with ShelfItem::title. (Closed)
Patch Set: Address comments. Created 3 years, 11 months 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 "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/extensions/extension_browsertest.h" 12 #include "chrome/browser/extensions/extension_browsertest.h"
12 #include "chrome/browser/ui/app_list/app_list_service.h" 13 #include "chrome/browser/ui/app_list/app_list_service.h"
13 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 14 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
14 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 15 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
15 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
16 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 17 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
17 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" 18 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
18 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 19 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
20 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 21 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // This tests simulates normal workflow for starting Arc app in deferred mode. 299 // This tests simulates normal workflow for starting Arc app in deferred mode.
299 IN_PROC_BROWSER_TEST_P(ArcAppDeferredLauncherBrowserTest, StartAppDeferred) { 300 IN_PROC_BROWSER_TEST_P(ArcAppDeferredLauncherBrowserTest, StartAppDeferred) {
300 // Install app to remember existing apps. 301 // Install app to remember existing apps.
301 StartInstance(); 302 StartInstance();
302 InstallTestApps(kTestAppPackage, false); 303 InstallTestApps(kTestAppPackage, false);
303 SendPackageAdded(kTestAppPackage, false); 304 SendPackageAdded(kTestAppPackage, false);
304 305
305 const std::string app_id = GetTestApp1Id(kTestAppPackage); 306 const std::string app_id = GetTestApp1Id(kTestAppPackage);
306 if (is_pinned()) { 307 if (is_pinned()) {
307 shelf_delegate()->PinAppWithID(app_id); 308 shelf_delegate()->PinAppWithID(app_id);
308 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); 309 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(app_id);
310 EXPECT_TRUE(shelf_id);
311 const ash::ShelfItem* item = chrome_controller()->GetItem(shelf_id);
312 EXPECT_EQ(base::UTF8ToUTF16(kTestAppName), item->title);
309 } else { 313 } else {
310 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id)); 314 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id));
311 } 315 }
312 316
313 StopInstance(); 317 StopInstance();
314 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = 318 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
315 app_prefs()->GetApp(app_id); 319 app_prefs()->GetApp(app_id);
316 EXPECT_FALSE(app_info); 320 EXPECT_FALSE(app_info);
317 321
318 // Restart instance. App should be taken from prefs but its state is non-ready 322 // Restart instance. App should be taken from prefs but its state is non-ready
319 // currently. 323 // currently.
320 StartInstance(); 324 StartInstance();
321 app_info = app_prefs()->GetApp(app_id); 325 app_info = app_prefs()->GetApp(app_id);
322 ASSERT_TRUE(app_info); 326 ASSERT_TRUE(app_info);
323 EXPECT_FALSE(app_info->ready); 327 EXPECT_FALSE(app_info->ready);
324 if (is_pinned()) 328 if (is_pinned())
325 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); 329 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id));
326 else 330 else
327 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id)); 331 EXPECT_FALSE(shelf_delegate()->GetShelfIDForAppID(app_id));
328 332
329 // Launching non-ready Arc app creates item on shelf and spinning animation. 333 // Launching non-ready Arc app creates item on shelf and spinning animation.
330 arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON); 334 arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON);
331 EXPECT_TRUE(shelf_delegate()->GetShelfIDForAppID(app_id)); 335 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(app_id);
336 EXPECT_TRUE(shelf_id);
337 const ash::ShelfItem* item = chrome_controller()->GetItem(shelf_id);
338 EXPECT_EQ(base::UTF8ToUTF16(kTestAppName), item->title);
332 AppAnimatedWaiter(app_id).Wait(); 339 AppAnimatedWaiter(app_id).Wait();
333 340
334 switch (test_action()) { 341 switch (test_action()) {
335 case TEST_ACTION_START: 342 case TEST_ACTION_START:
336 // Now simulates that Arc is started and app list is refreshed. This 343 // Now simulates that Arc is started and app list is refreshed. This
337 // should stop animation and delete icon from the shelf. 344 // should stop animation and delete icon from the shelf.
338 InstallTestApps(kTestAppPackage, false); 345 InstallTestApps(kTestAppPackage, false);
339 SendPackageAdded(kTestAppPackage, false); 346 SendPackageAdded(kTestAppPackage, false);
340 EXPECT_TRUE(chrome_controller() 347 EXPECT_TRUE(chrome_controller()
341 ->GetArcDeferredLauncher() 348 ->GetArcDeferredLauncher()
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 app_host()->OnTaskDestroyed(2); 541 app_host()->OnTaskDestroyed(2);
535 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); 542 EXPECT_EQ(controller2, GetAppItemController(shelf_id2));
536 // Destroy task #2, this kills shelf group 2 543 // Destroy task #2, this kills shelf group 2
537 app_host()->OnTaskDestroyed(3); 544 app_host()->OnTaskDestroyed(3);
538 EXPECT_FALSE(GetAppItemController(shelf_id2)); 545 EXPECT_FALSE(GetAppItemController(shelf_id2));
539 546
540 // Disable Arc, this removes app and as result kills shelf group 3. 547 // Disable Arc, this removes app and as result kills shelf group 3.
541 arc::ArcSessionManager::Get()->DisableArc(); 548 arc::ArcSessionManager::Get()->DisableArc();
542 EXPECT_FALSE(GetAppItemController(shelf_id3)); 549 EXPECT_FALSE(GetAppItemController(shelf_id3));
543 } 550 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698