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

Side by Side Diff: chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 years, 6 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 <memory> 5 #include <memory>
6 6
7 #include "ash/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/shelf/app_list_button.h" 8 #include "ash/shelf/app_list_button.h"
9 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shelf/wm_shelf.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/wm/window_util.h" 12 #include "ash/wm/window_util.h"
13 #include "ash/wm_window.h" 13 #include "ash/wm_window.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "ui/app_list/presenter/app_list.h" 16 #include "ui/app_list/presenter/app_list.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/events/test/event_generator.h" 18 #include "ui/events/test/event_generator.h"
19 19
20 using AppListTest = InProcessBrowserTest; 20 using AppListTest = InProcessBrowserTest;
21 21
22 // An integration test to toggle the app list by pressing the shelf button. 22 // An integration test to toggle the app list by pressing the shelf button.
23 IN_PROC_BROWSER_TEST_F(AppListTest, PressAppListButtonToShowAndDismiss) { 23 IN_PROC_BROWSER_TEST_F(AppListTest, PressAppListButtonToShowAndDismiss) {
24 ash::WmShelf* shelf = ash::WmShelf::ForWindow(ash::wm::GetActiveWindow()); 24 ash::Shelf* shelf = ash::Shelf::ForWindow(ash::wm::GetActiveWindow());
25 ash::ShelfWidget* shelf_widget = shelf->shelf_widget(); 25 ash::ShelfWidget* shelf_widget = shelf->shelf_widget();
26 ash::AppListButton* app_list_button = shelf_widget->GetAppListButton(); 26 ash::AppListButton* app_list_button = shelf_widget->GetAppListButton();
27 27
28 aura::Window* root_window = ash::wm::GetActiveWindow()->GetRootWindow(); 28 aura::Window* root_window = ash::wm::GetActiveWindow()->GetRootWindow();
29 aura::Window* app_list_container = 29 aura::Window* app_list_container =
30 root_window->GetChildById(ash::kShellWindowId_AppListContainer); 30 root_window->GetChildById(ash::kShellWindowId_AppListContainer);
31 ui::test::EventGenerator generator(shelf_widget->GetNativeWindow()); 31 ui::test::EventGenerator generator(shelf_widget->GetNativeWindow());
32 32
33 // Click the app list button to show the app list. 33 // Click the app list button to show the app list.
34 ash::Shell* shell = ash::Shell::Get(); 34 ash::Shell* shell = ash::Shell::Get();
35 EXPECT_FALSE(shell->app_list()->GetTargetVisibility()); 35 EXPECT_FALSE(shell->app_list()->GetTargetVisibility());
36 EXPECT_EQ(0u, app_list_container->children().size()); 36 EXPECT_EQ(0u, app_list_container->children().size());
37 EXPECT_FALSE(app_list_button->is_showing_app_list()); 37 EXPECT_FALSE(app_list_button->is_showing_app_list());
38 generator.set_current_location( 38 generator.set_current_location(
39 app_list_button->GetBoundsInScreen().CenterPoint()); 39 app_list_button->GetBoundsInScreen().CenterPoint());
40 generator.ClickLeftButton(); 40 generator.ClickLeftButton();
41 base::RunLoop().RunUntilIdle(); 41 base::RunLoop().RunUntilIdle();
42 EXPECT_TRUE(shell->app_list()->GetTargetVisibility()); 42 EXPECT_TRUE(shell->app_list()->GetTargetVisibility());
43 EXPECT_EQ(1u, app_list_container->children().size()); 43 EXPECT_EQ(1u, app_list_container->children().size());
44 EXPECT_TRUE(app_list_button->is_showing_app_list()); 44 EXPECT_TRUE(app_list_button->is_showing_app_list());
45 45
46 // Click the button again to dismiss the app list; the window animates closed. 46 // Click the button again to dismiss the app list; the window animates closed.
47 generator.ClickLeftButton(); 47 generator.ClickLeftButton();
48 base::RunLoop().RunUntilIdle(); 48 base::RunLoop().RunUntilIdle();
49 EXPECT_FALSE(shell->app_list()->GetTargetVisibility()); 49 EXPECT_FALSE(shell->app_list()->GetTargetVisibility());
50 EXPECT_EQ(1u, app_list_container->children().size()); 50 EXPECT_EQ(1u, app_list_container->children().size());
51 EXPECT_FALSE(app_list_button->is_showing_app_list()); 51 EXPECT_FALSE(app_list_button->is_showing_app_list());
52 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698