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

Side by Side Diff: ash/wm/panels/panel_layout_manager_unittest.cc

Issue 2183483002: Clean up ash::ShellTestApi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/wm/panels/panel_layout_manager.h" 5 #include "ash/common/wm/panels/panel_layout_manager.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/ash_switches.h" 8 #include "ash/common/ash_switches.h"
9 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
11 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/wm/mru_window_tracker.h" 12 #include "ash/common/wm/mru_window_tracker.h"
13 #include "ash/common/wm/window_state.h" 13 #include "ash/common/wm/window_state.h"
14 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
15 #include "ash/screen_util.h" 15 #include "ash/screen_util.h"
16 #include "ash/shelf/shelf.h" 16 #include "ash/shelf/shelf.h"
17 #include "ash/shelf/shelf_button.h" 17 #include "ash/shelf/shelf_button.h"
18 #include "ash/shelf/shelf_layout_manager.h" 18 #include "ash/shelf/shelf_layout_manager.h"
19 #include "ash/shelf/shelf_util.h" 19 #include "ash/shelf/shelf_util.h"
20 #include "ash/shelf/shelf_view.h" 20 #include "ash/shelf/shelf_view.h"
21 #include "ash/shelf/shelf_widget.h" 21 #include "ash/shelf/shelf_widget.h"
22 #include "ash/shell.h" 22 #include "ash/shell.h"
23 #include "ash/test/ash_test_base.h" 23 #include "ash/test/ash_test_base.h"
24 #include "ash/test/shelf_test_api.h" 24 #include "ash/test/shelf_test_api.h"
25 #include "ash/test/shelf_view_test_api.h" 25 #include "ash/test/shelf_view_test_api.h"
26 #include "ash/test/shell_test_api.h"
27 #include "ash/test/test_shelf_delegate.h" 26 #include "ash/test/test_shelf_delegate.h"
28 #include "ash/wm/window_state_aura.h" 27 #include "ash/wm/window_state_aura.h"
29 #include "ash/wm/window_util.h" 28 #include "ash/wm/window_util.h"
30 #include "base/command_line.h" 29 #include "base/command_line.h"
31 #include "base/compiler_specific.h" 30 #include "base/compiler_specific.h"
32 #include "base/i18n/rtl.h" 31 #include "base/i18n/rtl.h"
33 #include "base/run_loop.h" 32 #include "base/run_loop.h"
34 #include "ui/aura/client/aura_constants.h" 33 #include "ui/aura/client/aura_constants.h"
35 #include "ui/aura/test/test_windows.h" 34 #include "ui/aura/test/test_windows.h"
36 #include "ui/aura/window.h" 35 #include "ui/aura/window.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 187 }
189 188
190 test::ShelfViewTestAPI* shelf_view_test() { return shelf_view_test_.get(); } 189 test::ShelfViewTestAPI* shelf_view_test() { return shelf_view_test_.get(); }
191 190
192 // Clicks the shelf items on |shelf_view| that is associated with given 191 // Clicks the shelf items on |shelf_view| that is associated with given
193 // |window|. 192 // |window|.
194 void ClickShelfItemForWindow(ShelfView* shelf_view, aura::Window* window) { 193 void ClickShelfItemForWindow(ShelfView* shelf_view, aura::Window* window) {
195 test::ShelfViewTestAPI test_api(shelf_view); 194 test::ShelfViewTestAPI test_api(shelf_view);
196 test_api.SetAnimationDuration(1); 195 test_api.SetAnimationDuration(1);
197 test_api.RunMessageLoopUntilAnimationsDone(); 196 test_api.RunMessageLoopUntilAnimationsDone();
198 ShelfModel* model = test::ShellTestApi(Shell::GetInstance()).shelf_model(); 197 int index = WmShell::Get()->shelf_model()->ItemIndexByID(
199 int index = model->ItemIndexByID(GetShelfIDForWindow(window)); 198 GetShelfIDForWindow(window));
200 gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen(); 199 gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen();
201 200
202 ui::test::EventGenerator& event_generator = GetEventGenerator(); 201 ui::test::EventGenerator& event_generator = GetEventGenerator();
203 event_generator.MoveMouseTo(bounds.CenterPoint()); 202 event_generator.MoveMouseTo(bounds.CenterPoint());
204 event_generator.ClickLeftButton(); 203 event_generator.ClickLeftButton();
205 204
206 test_api.RunMessageLoopUntilAnimationsDone(); 205 test_api.RunMessageLoopUntilAnimationsDone();
207 } 206 }
208 207
209 void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) { 208 void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) {
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 807 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5));
809 target = targeter->FindTargetForEvent(root, &touch); 808 target = targeter->FindTargetForEvent(root, &touch);
810 EXPECT_NE(w.get(), target); 809 EXPECT_NE(w.get(), target);
811 } 810 }
812 811
813 INSTANTIATE_TEST_CASE_P(LtrRtl, 812 INSTANTIATE_TEST_CASE_P(LtrRtl,
814 PanelLayoutManagerTextDirectionTest, 813 PanelLayoutManagerTextDirectionTest,
815 testing::Bool()); 814 testing::Bool());
816 815
817 } // namespace ash 816 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698