| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_HELPER_H_ | 5 #ifndef ASH_TEST_ASH_TEST_HELPER_H_ |
| 6 #define ASH_TEST_ASH_TEST_HELPER_H_ | 6 #define ASH_TEST_ASH_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> |
| 11 #include <utility> | 12 #include <utility> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "ash/test/test_session_controller_client.h" | 15 #include "ash/test/test_session_controller_client.h" |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/test/scoped_command_line.h" | 18 #include "base/test/scoped_command_line.h" |
| 18 #include "ui/aura/test/mus/test_window_tree_client_setup.h" | 19 #include "ui/aura/test/mus/test_window_tree_client_setup.h" |
| 19 | 20 |
| 20 namespace aura { | 21 namespace aura { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 class WindowManagerApplication; | 52 class WindowManagerApplication; |
| 52 } | 53 } |
| 53 | 54 |
| 54 namespace test { | 55 namespace test { |
| 55 | 56 |
| 56 class AshTestEnvironment; | 57 class AshTestEnvironment; |
| 57 class AshTestViewsDelegate; | 58 class AshTestViewsDelegate; |
| 58 class TestScreenshotDelegate; | 59 class TestScreenshotDelegate; |
| 59 class TestShellDelegate; | 60 class TestShellDelegate; |
| 60 class TestSessionControllerClient; | 61 class TestSessionControllerClient; |
| 61 class TestSessionStateDelegate; | |
| 62 | 62 |
| 63 // A helper class that does common initialization required for Ash. Creates a | 63 // A helper class that does common initialization required for Ash. Creates a |
| 64 // root window and an ash::Shell instance with a test delegate. | 64 // root window and an ash::Shell instance with a test delegate. |
| 65 class AshTestHelper { | 65 class AshTestHelper { |
| 66 public: | 66 public: |
| 67 explicit AshTestHelper(AshTestEnvironment* ash_test_environment); | 67 explicit AshTestHelper(AshTestEnvironment* ash_test_environment); |
| 68 ~AshTestHelper(); | 68 ~AshTestHelper(); |
| 69 | 69 |
| 70 // Returns the configuration that tests are run in. See ash::Config enum for | 70 // Returns the configuration that tests are run in. See ash::Config enum for |
| 71 // details. | 71 // details. |
| 72 static Config config() { return config_; } | 72 static Config config() { return config_; } |
| 73 | 73 |
| 74 // Creates the ash::Shell and performs associated initialization. Set | 74 // Creates the ash::Shell and performs associated initialization. Set |
| 75 // |start_session| to true if the user should log in before the test is run. | 75 // |start_session| to true if the user should log in before the test is run. |
| 76 void SetUp(bool start_session); | 76 void SetUp(bool start_session); |
| 77 | 77 |
| 78 // Destroys the ash::Shell and performs associated cleanup. | 78 // Destroys the ash::Shell and performs associated cleanup. |
| 79 void TearDown(); | 79 void TearDown(); |
| 80 | 80 |
| 81 // Returns a root Window. Usually this is the active root Window, but that | 81 // Returns a root Window. Usually this is the active root Window, but that |
| 82 // method can return NULL sometimes, and in those cases, we fall back on the | 82 // method can return NULL sometimes, and in those cases, we fall back on the |
| 83 // primary root Window. | 83 // primary root Window. |
| 84 aura::Window* CurrentContext(); | 84 aura::Window* CurrentContext(); |
| 85 | 85 |
| 86 void RunAllPendingInMessageLoop(); | 86 void RunAllPendingInMessageLoop(); |
| 87 | 87 |
| 88 static TestSessionStateDelegate* GetTestSessionStateDelegate(); | |
| 89 | |
| 90 TestShellDelegate* test_shell_delegate() { return test_shell_delegate_; } | 88 TestShellDelegate* test_shell_delegate() { return test_shell_delegate_; } |
| 91 void set_test_shell_delegate(TestShellDelegate* test_shell_delegate) { | 89 void set_test_shell_delegate(TestShellDelegate* test_shell_delegate) { |
| 92 test_shell_delegate_ = test_shell_delegate; | 90 test_shell_delegate_ = test_shell_delegate; |
| 93 } | 91 } |
| 94 TestScreenshotDelegate* test_screenshot_delegate() { | 92 TestScreenshotDelegate* test_screenshot_delegate() { |
| 95 return test_screenshot_delegate_; | 93 return test_screenshot_delegate_; |
| 96 } | 94 } |
| 97 AshTestViewsDelegate* test_views_delegate() { | 95 AshTestViewsDelegate* test_views_delegate() { |
| 98 return test_views_delegate_.get(); | 96 return test_views_delegate_.get(); |
| 99 } | 97 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 174 |
| 177 std::unique_ptr<base::test::ScopedCommandLine> command_line_; | 175 std::unique_ptr<base::test::ScopedCommandLine> command_line_; |
| 178 | 176 |
| 179 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); | 177 DISALLOW_COPY_AND_ASSIGN(AshTestHelper); |
| 180 }; | 178 }; |
| 181 | 179 |
| 182 } // namespace test | 180 } // namespace test |
| 183 } // namespace ash | 181 } // namespace ash |
| 184 | 182 |
| 185 #endif // ASH_TEST_ASH_TEST_HELPER_H_ | 183 #endif // ASH_TEST_ASH_TEST_HELPER_H_ |
| OLD | NEW |