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_); |
195 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); | 196 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); |
196 } | 197 } |
197 | 198 |
198 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } | 199 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } |
199 | 200 |
200 ash::ShelfID CreateAppShortcutLauncherItem( | 201 ash::ShelfID CreateAppShortcutLauncherItem( |
201 const ash::launcher::AppLauncherId& app_launcher_id) { | 202 const ash::launcher::AppLauncherId& app_launcher_id) { |
202 return controller_->CreateAppShortcutLauncherItem( | 203 return controller_->CreateAppShortcutLauncherItem( |
203 app_launcher_id, shelf_model()->item_count()); | 204 app_launcher_id, shelf_model()->item_count()); |
204 } | 205 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) { | 256 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) { |
256 } | 257 } |
257 | 258 |
258 ~ShelfAppBrowserTest() override {} | 259 ~ShelfAppBrowserTest() override {} |
259 | 260 |
260 void RunTestOnMainThreadLoop() override { | 261 void RunTestOnMainThreadLoop() override { |
261 shelf_ = | 262 shelf_ = |
262 ash::WmShelf::ForWindow(ash::WmShell::Get()->GetPrimaryRootWindow()); | 263 ash::WmShelf::ForWindow(ash::WmShell::Get()->GetPrimaryRootWindow()); |
263 model_ = ash::WmShell::Get()->shelf_model(); | 264 model_ = ash::WmShell::Get()->shelf_model(); |
264 controller_ = GetChromeLauncherControllerImpl(); | 265 controller_ = GetChromeLauncherControllerImpl(); |
| 266 ASSERT_TRUE(controller_); |
265 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); | 267 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); |
266 } | 268 } |
267 | 269 |
268 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { | 270 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { |
269 LauncherItemController* item_controller = | 271 LauncherItemController* item_controller = |
270 controller_->GetBrowserShortcutLauncherItemController(); | 272 controller_->GetBrowserShortcutLauncherItemController(); |
271 int items = item_controller->GetApplicationList( | 273 int items = item_controller->GetApplicationList( |
272 show_all_tabs ? ui::EF_SHIFT_DOWN : 0).size(); | 274 show_all_tabs ? ui::EF_SHIFT_DOWN : 0).size(); |
273 // If we have at least one item, we have also a title which we remove here. | 275 // If we have at least one item, we have also a title which we remove here. |
274 return items ? (items - 1) : 0; | 276 return items ? (items - 1) : 0; |
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 | 2419 |
2418 // Close all windows via the menu item. | 2420 // Close all windows via the menu item. |
2419 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2421 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
2420 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2422 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
2421 | 2423 |
2422 // Check if "Close" is removed from the context menu. | 2424 // Check if "Close" is removed from the context menu. |
2423 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2425 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
2424 ASSERT_FALSE( | 2426 ASSERT_FALSE( |
2425 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2427 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
2426 } | 2428 } |
OLD | NEW |