OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 class LauncherPlatformAppBrowserTest | 186 class LauncherPlatformAppBrowserTest |
187 : public extensions::PlatformAppBrowserTest { | 187 : public extensions::PlatformAppBrowserTest { |
188 protected: | 188 protected: |
189 LauncherPlatformAppBrowserTest() : controller_(nullptr) {} | 189 LauncherPlatformAppBrowserTest() : controller_(nullptr) {} |
190 | 190 |
191 ~LauncherPlatformAppBrowserTest() override {} | 191 ~LauncherPlatformAppBrowserTest() override {} |
192 | 192 |
193 void RunTestOnMainThreadLoop() override { | 193 void RunTestOnMainThreadLoop() override { |
194 controller_ = GetChromeLauncherControllerImpl(); | 194 controller_ = GetChromeLauncherControllerImpl(); |
195 ASSERT_TRUE(controller_); | |
196 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); | 195 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); |
197 } | 196 } |
198 | 197 |
199 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } | 198 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } |
200 | 199 |
201 ash::ShelfID CreateAppShortcutLauncherItem( | 200 ash::ShelfID CreateAppShortcutLauncherItem( |
202 const ash::launcher::AppLauncherId& app_launcher_id) { | 201 const ash::launcher::AppLauncherId& app_launcher_id) { |
203 return controller_->CreateAppShortcutLauncherItem( | 202 return controller_->CreateAppShortcutLauncherItem( |
204 app_launcher_id, shelf_model()->item_count()); | 203 app_launcher_id, shelf_model()->item_count()); |
205 } | 204 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) { | 255 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) { |
257 } | 256 } |
258 | 257 |
259 ~ShelfAppBrowserTest() override {} | 258 ~ShelfAppBrowserTest() override {} |
260 | 259 |
261 void RunTestOnMainThreadLoop() override { | 260 void RunTestOnMainThreadLoop() override { |
262 shelf_ = | 261 shelf_ = |
263 ash::WmShelf::ForWindow(ash::WmShell::Get()->GetPrimaryRootWindow()); | 262 ash::WmShelf::ForWindow(ash::WmShell::Get()->GetPrimaryRootWindow()); |
264 model_ = ash::WmShell::Get()->shelf_model(); | 263 model_ = ash::WmShell::Get()->shelf_model(); |
265 controller_ = GetChromeLauncherControllerImpl(); | 264 controller_ = GetChromeLauncherControllerImpl(); |
266 ASSERT_TRUE(controller_); | |
267 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); | 265 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); |
268 } | 266 } |
269 | 267 |
270 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { | 268 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { |
271 LauncherItemController* item_controller = | 269 LauncherItemController* item_controller = |
272 controller_->GetBrowserShortcutLauncherItemController(); | 270 controller_->GetBrowserShortcutLauncherItemController(); |
273 int items = item_controller->GetApplicationList( | 271 int items = item_controller->GetApplicationList( |
274 show_all_tabs ? ui::EF_SHIFT_DOWN : 0).size(); | 272 show_all_tabs ? ui::EF_SHIFT_DOWN : 0).size(); |
275 // If we have at least one item, we have also a title which we remove here. | 273 // If we have at least one item, we have also a title which we remove here. |
276 return items ? (items - 1) : 0; | 274 return items ? (items - 1) : 0; |
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 | 2418 |
2421 // Close all windows via the menu item. | 2419 // Close all windows via the menu item. |
2422 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2420 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
2423 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2421 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
2424 | 2422 |
2425 // Check if "Close" is removed from the context menu. | 2423 // Check if "Close" is removed from the context menu. |
2426 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2424 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
2427 ASSERT_FALSE( | 2425 ASSERT_FALSE( |
2428 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2426 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
2429 } | 2427 } |
OLD | NEW |