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