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 <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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool CanDoShowAppInfoFlow() override { return can_show_app_info_; } | 72 bool CanDoShowAppInfoFlow() override { return can_show_app_info_; } |
73 | 73 |
74 private: | 74 private: |
75 std::map<std::string, Pinnable> pinnable_apps_; | 75 std::map<std::string, Pinnable> pinnable_apps_; |
76 bool can_create_shortcuts_ = false; | 76 bool can_create_shortcuts_ = false; |
77 bool can_show_app_info_ = false; | 77 bool can_show_app_info_ = false; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(FakeAppListControllerDelegate); | 79 DISALLOW_COPY_AND_ASSIGN(FakeAppListControllerDelegate); |
80 }; | 80 }; |
81 | 81 |
82 scoped_ptr<KeyedService> MenuManagerFactory(content::BrowserContext* context) { | 82 std::unique_ptr<KeyedService> MenuManagerFactory( |
| 83 content::BrowserContext* context) { |
83 return extensions::MenuManagerFactory::BuildServiceInstanceForTesting( | 84 return extensions::MenuManagerFactory::BuildServiceInstanceForTesting( |
84 context); | 85 context); |
85 } | 86 } |
86 | 87 |
87 } // namespace | 88 } // namespace |
88 | 89 |
89 class AppContextMenuTest : public AppListTestBase { | 90 class AppContextMenuTest : public AppListTestBase { |
90 public: | 91 public: |
91 AppContextMenuTest() = default; | 92 AppContextMenuTest() = default; |
92 ~AppContextMenuTest() override { | 93 ~AppContextMenuTest() override { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 states.push_back(MenuState( | 269 states.push_back(MenuState( |
269 app_list::AppContextMenu::MENU_NEW_INCOGNITO_WINDOW)); | 270 app_list::AppContextMenu::MENU_NEW_INCOGNITO_WINDOW)); |
270 } | 271 } |
271 if (can_show_app_info) | 272 if (can_show_app_info) |
272 states.push_back(MenuState(app_list::AppContextMenu::SHOW_APP_INFO)); | 273 states.push_back(MenuState(app_list::AppContextMenu::SHOW_APP_INFO)); |
273 | 274 |
274 ValidateMenuState(menu_model, states); | 275 ValidateMenuState(menu_model, states); |
275 } | 276 } |
276 | 277 |
277 private: | 278 private: |
278 scoped_ptr<KeyedService> menu_manager_; | 279 std::unique_ptr<KeyedService> menu_manager_; |
279 scoped_ptr<FakeAppListControllerDelegate> controller_; | 280 std::unique_ptr<FakeAppListControllerDelegate> controller_; |
280 scoped_ptr<FakeAppContextMenuDelegate> menu_delegate_; | 281 std::unique_ptr<FakeAppContextMenuDelegate> menu_delegate_; |
281 | 282 |
282 DISALLOW_COPY_AND_ASSIGN(AppContextMenuTest); | 283 DISALLOW_COPY_AND_ASSIGN(AppContextMenuTest); |
283 }; | 284 }; |
284 | 285 |
285 TEST_F(AppContextMenuTest, ExtensionApp) { | 286 TEST_F(AppContextMenuTest, ExtensionApp) { |
286 app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( | 287 app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( |
287 false); | 288 false); |
288 for (extensions::LaunchType launch_type = extensions::LAUNCH_TYPE_FIRST; | 289 for (extensions::LaunchType launch_type = extensions::LAUNCH_TYPE_FIRST; |
289 launch_type < extensions::NUM_LAUNCH_TYPES; | 290 launch_type < extensions::NUM_LAUNCH_TYPES; |
290 launch_type = static_cast<extensions::LaunchType>(launch_type+1)) { | 291 launch_type = static_cast<extensions::LaunchType>(launch_type+1)) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2)); | 438 EXPECT_EQ(app_list::AppContextMenu::TOGGLE_PIN, menu->GetCommandIdAt(2)); |
438 EXPECT_TRUE(menu->IsEnabledAt(2)); | 439 EXPECT_TRUE(menu->IsEnabledAt(2)); |
439 EXPECT_FALSE(menu->IsItemCheckedAt(2)); | 440 EXPECT_FALSE(menu->IsItemCheckedAt(2)); |
440 EXPECT_EQ(-1, menu->GetCommandIdAt(3)); // separator | 441 EXPECT_EQ(-1, menu->GetCommandIdAt(3)); // separator |
441 EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(4)); | 442 EXPECT_EQ(app_list::AppContextMenu::UNINSTALL, menu->GetCommandIdAt(4)); |
442 EXPECT_TRUE(menu->IsEnabledAt(4)); | 443 EXPECT_TRUE(menu->IsEnabledAt(4)); |
443 EXPECT_FALSE(menu->IsItemCheckedAt(4)); | 444 EXPECT_FALSE(menu->IsItemCheckedAt(4)); |
444 } | 445 } |
445 } | 446 } |
446 #endif | 447 #endif |
OLD | NEW |