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 #ifndef ASH_MUS_TEST_WM_TEST_BASE_H_ | 5 #ifndef ASH_MUS_TEST_WM_TEST_BASE_H_ |
6 #define ASH_MUS_TEST_WM_TEST_BASE_H_ | 6 #define ASH_MUS_TEST_WM_TEST_BASE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "ash/mus/bridge/wm_window_mus_test_api.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
14 #include "ui/wm/public/window_types.h" | 15 #include "ui/wm/public/window_types.h" |
15 | 16 |
| 17 namespace aura { |
| 18 class Window; |
| 19 } |
| 20 |
16 namespace display { | 21 namespace display { |
17 class Display; | 22 class Display; |
18 } | 23 } |
19 | 24 |
20 namespace gfx { | 25 namespace gfx { |
21 class Rect; | 26 class Rect; |
22 } | 27 } |
23 | 28 |
24 namespace ui { | 29 namespace ui { |
25 class Window; | 30 class ScopedAnimationDurationScaleMode; |
26 } | 31 } |
27 | 32 |
28 namespace ash { | 33 namespace ash { |
29 namespace mus { | 34 namespace mus { |
30 | 35 |
31 class AshTestImplMus; | 36 class AshTestImplMus; |
32 class WmTestHelper; | 37 class WmTestHelper; |
33 | 38 |
34 // Base class for window manager tests that want to configure | 39 // Base class for window manager tests that want to configure |
35 // WindowTreeClient without a client to mus. | 40 // WindowTreeClient without a client to mus. |
| 41 // TODO(sky): nuke this. |
36 class WmTestBase : public testing::Test { | 42 class WmTestBase : public testing::Test { |
37 public: | 43 public: |
38 WmTestBase(); | 44 WmTestBase(); |
39 ~WmTestBase() override; | 45 ~WmTestBase() override; |
40 | 46 |
41 // TODO(sky): temporary until http://crbug.com/611563 is fixed. | 47 // TODO(sky): temporary until http://crbug.com/611563 is fixed. |
42 bool SupportsMultipleDisplays() const; | 48 bool SupportsMultipleDisplays() const; |
43 | 49 |
44 // Update the display configuration as given in |display_spec|. | 50 // Update the display configuration as given in |display_spec|. |
45 // See test::DisplayManagerTestApi::UpdateDisplay for more details. | 51 // See test::DisplayManagerTestApi::UpdateDisplay for more details. |
46 void UpdateDisplay(const std::string& display_spec); | 52 void UpdateDisplay(const std::string& display_spec); |
47 | 53 |
48 ui::Window* GetPrimaryRootWindow(); | 54 aura::Window* GetPrimaryRootWindow(); |
49 ui::Window* GetSecondaryRootWindow(); | 55 aura::Window* GetSecondaryRootWindow(); |
50 | 56 |
51 display::Display GetPrimaryDisplay(); | 57 display::Display GetPrimaryDisplay(); |
52 display::Display GetSecondaryDisplay(); | 58 display::Display GetSecondaryDisplay(); |
53 | 59 |
54 // Creates a top level window visible window in the appropriate container. | 60 // Creates a top level window visible window in the appropriate container. |
55 // NOTE: you can explicitly destroy the returned value if necessary, but it | 61 // NOTE: you can explicitly destroy the returned value if necessary, but it |
56 // will also be automatically destroyed when the WindowTreeClient is | 62 // will also be automatically destroyed when the WindowTreeClient is |
57 // destroyed. | 63 // destroyed. |
58 ui::Window* CreateTestWindow(const gfx::Rect& bounds); | 64 aura::Window* CreateTestWindow(const gfx::Rect& bounds); |
59 ui::Window* CreateTestWindow(const gfx::Rect& bounds, | 65 aura::Window* CreateTestWindow(const gfx::Rect& bounds, |
60 ui::wm::WindowType window_type); | 66 ui::wm::WindowType window_type); |
61 | 67 |
62 // Creates a visibile fullscreen top level window on the display corresponding | 68 // Creates a visibile fullscreen top level window on the display corresponding |
63 // to the display_id provided. | 69 // to the display_id provided. |
64 ui::Window* CreateFullscreenTestWindow( | 70 aura::Window* CreateFullscreenTestWindow( |
65 int64_t display_id = display::kInvalidDisplayId); | 71 int64_t display_id = display::kInvalidDisplayId); |
66 | 72 |
67 // Creates a window parented to |parent|. The returned window is visible. | 73 // Creates a window parented to |parent|. The returned window is visible. |
68 ui::Window* CreateChildTestWindow(ui::Window* parent, | 74 aura::Window* CreateChildTestWindow(aura::Window* parent, |
69 const gfx::Rect& bounds); | 75 const gfx::Rect& bounds); |
70 | 76 |
71 protected: | 77 protected: |
72 // testing::Test: | 78 // testing::Test: |
73 void SetUp() override; | 79 void SetUp() override; |
74 void TearDown() override; | 80 void TearDown() override; |
75 | 81 |
76 private: | 82 private: |
77 friend class AshTestImplMus; | 83 friend class AshTestImplMus; |
78 | 84 |
79 bool setup_called_ = false; | 85 bool setup_called_ = false; |
80 bool teardown_called_ = false; | 86 bool teardown_called_ = false; |
| 87 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
| 88 std::unique_ptr<WmWindowMusTestApi::GlobalMinimumSizeLock> minimum_size_lock_; |
81 std::unique_ptr<WmTestHelper> test_helper_; | 89 std::unique_ptr<WmTestHelper> test_helper_; |
82 | 90 |
83 DISALLOW_COPY_AND_ASSIGN(WmTestBase); | 91 DISALLOW_COPY_AND_ASSIGN(WmTestBase); |
84 }; | 92 }; |
85 | 93 |
86 } // namespace mus | 94 } // namespace mus |
87 } // namespace ash | 95 } // namespace ash |
88 | 96 |
89 #endif // ASH_MUS_TEST_WM_TEST_BASE_H_ | 97 #endif // ASH_MUS_TEST_WM_TEST_BASE_H_ |
OLD | NEW |