| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_item_types.h" | 7 #include "ash/common/shelf/shelf_item_types.h" |
| 8 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 protected: | 28 protected: |
| 29 static bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { | 29 static bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { |
| 30 return menu->GetIndexOfCommandId(command_id) != -1; | 30 return menu->GetIndexOfCommandId(command_id) != -1; |
| 31 } | 31 } |
| 32 | 32 |
| 33 LauncherContextMenuTest() : profile_(new TestingProfile()) {} | 33 LauncherContextMenuTest() : profile_(new TestingProfile()) {} |
| 34 | 34 |
| 35 void SetUp() override { | 35 void SetUp() override { |
| 36 arc_test_.SetUp(profile_.get()); | 36 arc_test_.SetUp(profile_.get()); |
| 37 ash::test::AshTestBase::SetUp(); | 37 ash::test::AshTestBase::SetUp(); |
| 38 controller_.reset(new ChromeLauncherController(profile(), &shelf_model_)); | 38 |
| 39 ash::ShelfItem app_list; |
| 40 app_list.type = ash::TYPE_APP_LIST; |
| 41 shelf_model_.Add(app_list); |
| 42 |
| 43 controller_.reset(new ChromeLauncherController( |
| 44 profile(), ash::Shell::GetInstance()->shelf_model())); |
| 45 controller_->Init(); |
| 39 } | 46 } |
| 40 | 47 |
| 41 void TearDown() override { | 48 void TearDown() override { |
| 42 controller_.reset(nullptr); | 49 controller_.reset(nullptr); |
| 43 ash::test::AshTestBase::TearDown(); | 50 ash::test::AshTestBase::TearDown(); |
| 44 } | 51 } |
| 45 | 52 |
| 46 LauncherContextMenu* CreateLauncherContextMenu( | 53 LauncherContextMenu* CreateLauncherContextMenu( |
| 47 ash::ShelfItemType shelf_item_type) { | 54 ash::ShelfItemType shelf_item_type) { |
| 48 ash::ShelfItem item; | 55 ash::ShelfItem item; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 arc_test().app_instance()->SendTaskCreated(1, arc_test().fake_apps()[0]); | 197 arc_test().app_instance()->SendTaskCreated(1, arc_test().fake_apps()[0]); |
| 191 menu.reset(new ArcLauncherContextMenu(controller(), &item, shelf)); | 198 menu.reset(new ArcLauncherContextMenu(controller(), &item, shelf)); |
| 192 | 199 |
| 193 EXPECT_FALSE( | 200 EXPECT_FALSE( |
| 194 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); | 201 IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); |
| 195 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); | 202 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_PIN)); |
| 196 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_PIN)); | 203 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_PIN)); |
| 197 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); | 204 EXPECT_TRUE(IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_CLOSE)); |
| 198 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE)); | 205 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_CLOSE)); |
| 199 } | 206 } |
| OLD | NEW |