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

Side by Side Diff: chrome/browser/ui/app_list/app_context_menu_unittest.cc

Issue 1885683005: Add module suffix in .mojom files for components/arc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 8 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ui::MenuModel* menu_model = menu.GetMenuModel(); 337 ui::MenuModel* menu_model = menu.GetMenuModel();
338 EXPECT_EQ(nullptr, menu_model); 338 EXPECT_EQ(nullptr, menu_model);
339 } 339 }
340 340
341 #if defined(OS_CHROMEOS) 341 #if defined(OS_CHROMEOS)
342 TEST_F(AppContextMenuTest, ArcMenu) { 342 TEST_F(AppContextMenuTest, ArcMenu) {
343 ArcAppTest arc_test; 343 ArcAppTest arc_test;
344 arc_test.SetUp(profile()); 344 arc_test.SetUp(profile());
345 arc_test.bridge_service()->SetReady(); 345 arc_test.bridge_service()->SetReady();
346 346
347 const arc::AppInfo& app_info = arc_test.fake_apps()[0]; 347 const arc::mojom::AppInfo& app_info = arc_test.fake_apps()[0];
348 const std::string app_id = ArcAppTest::GetAppId(app_info); 348 const std::string app_id = ArcAppTest::GetAppId(app_info);
349 controller()->SetAppPinnable(app_id, AppListControllerDelegate::PIN_EDITABLE); 349 controller()->SetAppPinnable(app_id, AppListControllerDelegate::PIN_EDITABLE);
350 350
351 arc_test.app_instance()->RefreshAppList(); 351 arc_test.app_instance()->RefreshAppList();
352 arc_test.app_instance()->SendRefreshAppList(arc_test.fake_apps()); 352 arc_test.app_instance()->SendRefreshAppList(arc_test.fake_apps());
353 353
354 ArcAppItem item(profile(), nullptr, app_id, std::string(), true); 354 ArcAppItem item(profile(), nullptr, app_id, std::string(), true);
355 355
356 ui::MenuModel* menu = item.GetContextMenuModel(); 356 ui::MenuModel* menu = item.GetContextMenuModel();
357 ASSERT_NE(nullptr, menu); 357 ASSERT_NE(nullptr, menu);
(...skipping 12 matching lines...) Expand all
370 370
371 menu->ActivatedAt(0); 371 menu->ActivatedAt(0);
372 arc_test.app_instance()->WaitForIncomingMethodCall(); 372 arc_test.app_instance()->WaitForIncomingMethodCall();
373 373
374 const ScopedVector<arc::FakeAppInstance::Request>& launch_requests = 374 const ScopedVector<arc::FakeAppInstance::Request>& launch_requests =
375 arc_test.app_instance()->launch_requests(); 375 arc_test.app_instance()->launch_requests();
376 ASSERT_EQ(1u, launch_requests.size()); 376 ASSERT_EQ(1u, launch_requests.size());
377 EXPECT_TRUE(launch_requests[0]->IsForApp(app_info)); 377 EXPECT_TRUE(launch_requests[0]->IsForApp(app_info));
378 378
379 arc_test.app_instance()->RefreshAppList(); 379 arc_test.app_instance()->RefreshAppList();
380 arc_test.app_instance()->SendRefreshAppList(std::vector<arc::AppInfo>()); 380 arc_test.app_instance()->SendRefreshAppList(
381 std::vector<arc::mojom::AppInfo>());
381 item.SetReady(false); 382 item.SetReady(false);
382 383
383 EXPECT_EQ(item.GetContextMenuModel(), menu); 384 EXPECT_EQ(item.GetContextMenuModel(), menu);
384 ASSERT_EQ(3, menu->GetItemCount()); 385 ASSERT_EQ(3, menu->GetItemCount());
385 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0)); 386 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
386 EXPECT_FALSE(menu->IsEnabledAt(0)); 387 EXPECT_FALSE(menu->IsEnabledAt(0));
387 EXPECT_FALSE(menu->IsItemCheckedAt(0)); 388 EXPECT_FALSE(menu->IsItemCheckedAt(0));
388 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator 389 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
389 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2)); 390 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
390 EXPECT_TRUE(menu->IsEnabledAt(2)); 391 EXPECT_TRUE(menu->IsEnabledAt(2));
391 EXPECT_FALSE(menu->IsItemCheckedAt(2)); 392 EXPECT_FALSE(menu->IsItemCheckedAt(2));
392 } 393 }
393 394
394 TEST_F(AppContextMenuTest, ArcMenuStickyItem) { 395 TEST_F(AppContextMenuTest, ArcMenuStickyItem) {
395 ArcAppTest arc_test; 396 ArcAppTest arc_test;
396 arc_test.SetUp(profile()); 397 arc_test.SetUp(profile());
397 arc_test.bridge_service()->SetReady(); 398 arc_test.bridge_service()->SetReady();
398 399
399 arc_test.app_instance()->RefreshAppList(); 400 arc_test.app_instance()->RefreshAppList();
400 arc_test.app_instance()->SendRefreshAppList(arc_test.fake_apps()); 401 arc_test.app_instance()->SendRefreshAppList(arc_test.fake_apps());
401 402
402 { 403 {
403 // Verify menu of store 404 // Verify menu of store
404 const arc::AppInfo& store_info = arc_test.fake_apps()[0]; 405 const arc::mojom::AppInfo& store_info = arc_test.fake_apps()[0];
405 const std::string store_id = ArcAppTest::GetAppId(store_info); 406 const std::string store_id = ArcAppTest::GetAppId(store_info);
406 controller()->SetAppPinnable(store_id, 407 controller()->SetAppPinnable(store_id,
407 AppListControllerDelegate::PIN_EDITABLE); 408 AppListControllerDelegate::PIN_EDITABLE);
408 ArcAppItem item(profile(), nullptr, store_id, std::string(), true); 409 ArcAppItem item(profile(), nullptr, store_id, std::string(), true);
409 ui::MenuModel* menu = item.GetContextMenuModel(); 410 ui::MenuModel* menu = item.GetContextMenuModel();
410 ASSERT_NE(nullptr, menu); 411 ASSERT_NE(nullptr, menu);
411 412
412 ASSERT_EQ(3, menu->GetItemCount()); 413 ASSERT_EQ(3, menu->GetItemCount());
413 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0)); 414 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
414 EXPECT_TRUE(menu->IsEnabledAt(0)); 415 EXPECT_TRUE(menu->IsEnabledAt(0));
415 EXPECT_FALSE(menu->IsItemCheckedAt(0)); 416 EXPECT_FALSE(menu->IsItemCheckedAt(0));
416 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator 417 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
417 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2)); 418 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
418 EXPECT_TRUE(menu->IsEnabledAt(2)); 419 EXPECT_TRUE(menu->IsEnabledAt(2));
419 EXPECT_FALSE(menu->IsItemCheckedAt(2)); 420 EXPECT_FALSE(menu->IsItemCheckedAt(2));
420 // No "uninstall" entry. 421 // No "uninstall" entry.
421 } 422 }
422 423
423 { 424 {
424 // Verify normal app menu 425 // Verify normal app menu
425 const arc::AppInfo& app_info = arc_test.fake_apps()[1]; 426 const arc::mojom::AppInfo& app_info = arc_test.fake_apps()[1];
426 const std::string app_id = ArcAppTest::GetAppId(app_info); 427 const std::string app_id = ArcAppTest::GetAppId(app_info);
427 controller()->SetAppPinnable(app_id, 428 controller()->SetAppPinnable(app_id,
428 AppListControllerDelegate::PIN_EDITABLE); 429 AppListControllerDelegate::PIN_EDITABLE);
429 ArcAppItem item(profile(), nullptr, app_id, std::string(), true); 430 ArcAppItem item(profile(), nullptr, app_id, std::string(), true);
430 ui::MenuModel* menu = item.GetContextMenuModel(); 431 ui::MenuModel* menu = item.GetContextMenuModel();
431 ASSERT_NE(nullptr, menu); 432 ASSERT_NE(nullptr, menu);
432 433
433 ASSERT_EQ(5, menu->GetItemCount()); 434 ASSERT_EQ(5, menu->GetItemCount());
434 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0)); 435 EXPECT_EQ(app_list::AppContextMenu::LAUNCH_NEW, menu->GetCommandIdAt(0));
435 EXPECT_TRUE(menu->IsEnabledAt(0)); 436 EXPECT_TRUE(menu->IsEnabledAt(0));
436 EXPECT_FALSE(menu->IsItemCheckedAt(0)); 437 EXPECT_FALSE(menu->IsItemCheckedAt(0));
437 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator 438 EXPECT_EQ(-1, menu->GetCommandIdAt(1)); // separator
438 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2)); 439 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2));
439 EXPECT_TRUE(menu->IsEnabledAt(2)); 440 EXPECT_TRUE(menu->IsEnabledAt(2));
440 EXPECT_FALSE(menu->IsItemCheckedAt(2)); 441 EXPECT_FALSE(menu->IsItemCheckedAt(2));
441 EXPECT_EQ(-1, menu->GetCommandIdAt(3)); // separator 442 EXPECT_EQ(-1, menu->GetCommandIdAt(3)); // separator
442 EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(4)); 443 EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(4));
443 EXPECT_TRUE(menu->IsEnabledAt(4)); 444 EXPECT_TRUE(menu->IsEnabledAt(4));
444 EXPECT_FALSE(menu->IsItemCheckedAt(4)); 445 EXPECT_FALSE(menu->IsItemCheckedAt(4));
445 } 446 }
446 } 447 }
447 #endif 448 #endif
OLDNEW
« no previous file with comments | « chrome/browser/task_management/providers/arc/arc_process_task.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_list_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698