| OLD | NEW |
| 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 #ifndef ASH_TEST_ASH_TEST_BASE_H_ | 5 #ifndef ASH_TEST_ASH_TEST_BASE_H_ |
| 6 #define ASH_TEST_ASH_TEST_BASE_H_ | 6 #define ASH_TEST_ASH_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class EventGenerator; | 42 class EventGenerator; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace views { | 46 namespace views { |
| 47 class Widget; | 47 class Widget; |
| 48 class WidgetDelegate; | 48 class WidgetDelegate; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace ash { | 51 namespace ash { |
| 52 class AshTestImplAura; | |
| 53 class SystemTray; | 52 class SystemTray; |
| 54 class WmShelf; | 53 class WmShelf; |
| 55 | 54 |
| 56 namespace test { | 55 namespace test { |
| 57 | 56 |
| 58 class AshTestEnvironment; | 57 class AshTestEnvironment; |
| 59 class AshTestHelper; | 58 class AshTestHelper; |
| 60 class TestScreenshotDelegate; | 59 class TestScreenshotDelegate; |
| 61 class TestSessionControllerClient; | 60 class TestSessionControllerClient; |
| 62 class TestSystemTrayDelegate; | 61 class TestSystemTrayDelegate; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // |bounds_in_screen| is empty the window is added to the primary root | 95 // |bounds_in_screen| is empty the window is added to the primary root |
| 97 // window, otherwise the window is added to the display matching | 96 // window, otherwise the window is added to the display matching |
| 98 // |bounds_in_screen|. |shell_window_id| is the shell window id to give to | 97 // |bounds_in_screen|. |shell_window_id| is the shell window id to give to |
| 99 // the new window. | 98 // the new window. |
| 100 // TODO(sky): convert existing CreateTestWindow() functions into this one. | 99 // TODO(sky): convert existing CreateTestWindow() functions into this one. |
| 101 std::unique_ptr<aura::Window> CreateTestWindow( | 100 std::unique_ptr<aura::Window> CreateTestWindow( |
| 102 const gfx::Rect& bounds_in_screen = gfx::Rect(), | 101 const gfx::Rect& bounds_in_screen = gfx::Rect(), |
| 103 ui::wm::WindowType type = ui::wm::WINDOW_TYPE_NORMAL, | 102 ui::wm::WindowType type = ui::wm::WINDOW_TYPE_NORMAL, |
| 104 int shell_window_id = kShellWindowId_Invalid); | 103 int shell_window_id = kShellWindowId_Invalid); |
| 105 | 104 |
| 105 // Creates a visible top-level window. For Config::CLASSIC and Config::MUS |
| 106 // this creates a Window with a delegate. For Config::MASH this creates a |
| 107 // window as if the client requested a top-level window. |
| 108 std::unique_ptr<aura::Window> CreateToplevelTestWindow( |
| 109 const gfx::Rect& bounds_in_screen = gfx::Rect(), |
| 110 int shell_window_id = kShellWindowId_Invalid); |
| 111 |
| 106 // Versions of the functions in aura::test:: that go through our shell | 112 // Versions of the functions in aura::test:: that go through our shell |
| 107 // StackingController instead of taking a parent. | 113 // StackingController instead of taking a parent. |
| 108 aura::Window* CreateTestWindowInShellWithId(int id); | 114 aura::Window* CreateTestWindowInShellWithId(int id); |
| 109 aura::Window* CreateTestWindowInShellWithBounds(const gfx::Rect& bounds); | 115 aura::Window* CreateTestWindowInShellWithBounds(const gfx::Rect& bounds); |
| 110 aura::Window* CreateTestWindowInShell(SkColor color, | 116 aura::Window* CreateTestWindowInShell(SkColor color, |
| 111 int id, | 117 int id, |
| 112 const gfx::Rect& bounds); | 118 const gfx::Rect& bounds); |
| 113 | 119 |
| 114 // Creates a visible window parented to |parent| with the specified bounds and | 120 // Creates a visible window parented to |parent| with the specified bounds and |
| 115 // id. | 121 // id. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 192 |
| 187 void DisableIME(); | 193 void DisableIME(); |
| 188 | 194 |
| 189 // Swap the primary display with the secondary. | 195 // Swap the primary display with the secondary. |
| 190 void SwapPrimaryDisplay(); | 196 void SwapPrimaryDisplay(); |
| 191 | 197 |
| 192 display::Display GetPrimaryDisplay(); | 198 display::Display GetPrimaryDisplay(); |
| 193 display::Display GetSecondaryDisplay(); | 199 display::Display GetSecondaryDisplay(); |
| 194 | 200 |
| 195 private: | 201 private: |
| 196 friend class ash::AshTestImplAura; | |
| 197 | |
| 198 bool setup_called_; | 202 bool setup_called_; |
| 199 bool teardown_called_; | 203 bool teardown_called_; |
| 200 // |SetUp()| doesn't activate session if this is set to false. | 204 // |SetUp()| doesn't activate session if this is set to false. |
| 201 bool start_session_; | 205 bool start_session_; |
| 202 std::unique_ptr<AshTestEnvironment> ash_test_environment_; | 206 std::unique_ptr<AshTestEnvironment> ash_test_environment_; |
| 203 std::unique_ptr<AshTestHelper> ash_test_helper_; | 207 std::unique_ptr<AshTestHelper> ash_test_helper_; |
| 204 std::unique_ptr<ui::test::EventGenerator> event_generator_; | 208 std::unique_ptr<ui::test::EventGenerator> event_generator_; |
| 205 | 209 |
| 206 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 210 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
| 207 }; | 211 }; |
| 208 | 212 |
| 209 class NoSessionAshTestBase : public AshTestBase { | 213 class NoSessionAshTestBase : public AshTestBase { |
| 210 public: | 214 public: |
| 211 NoSessionAshTestBase() { set_start_session(false); } | 215 NoSessionAshTestBase() { set_start_session(false); } |
| 212 ~NoSessionAshTestBase() override {} | 216 ~NoSessionAshTestBase() override {} |
| 213 | 217 |
| 214 private: | 218 private: |
| 215 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); | 219 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); |
| 216 }; | 220 }; |
| 217 | 221 |
| 218 } // namespace test | 222 } // namespace test |
| 219 } // namespace ash | 223 } // namespace ash |
| 220 | 224 |
| 221 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 225 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
| OLD | NEW |