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
3 // found in the LICENSE file.
5 #ifndef ASH_TEST_ASH_TEST_HELPER_H_
6 #define ASH_TEST_ASH_TEST_HELPER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
16 class MessageLoopForUI;
20 class ScopedAnimationDurationScaleMode;
32 class TestScreenshotDelegate;
33 class TestShellDelegate;
35 // A helper class that does common initialization required for Ash. Creates a
36 // root window and an ash::Shell instance with a test delegate.
39 explicit AshTestHelper(base::MessageLoopForUI* message_loop);
42 // Creates the ash::Shell and performs associated initialization.
43 // Set |start_session| to true if the user should log in before
45 void SetUp(bool start_session);
47 // Destroys the ash::Shell and performs associated cleanup.
50 // Returns a root Window. Usually this is the active root Window, but that
51 // method can return NULL sometimes, and in those cases, we fall back on the
52 // primary root Window.
53 aura::Window* CurrentContext();
55 void RunAllPendingInMessageLoop();
57 base::MessageLoopForUI* message_loop() { return message_loop_; }
58 TestShellDelegate* test_shell_delegate() { return test_shell_delegate_; }
59 TestScreenshotDelegate* test_screenshot_delegate() {
60 return test_screenshot_delegate_;
64 base::MessageLoopForUI* message_loop_; // Not owned.
65 TestShellDelegate* test_shell_delegate_; // Owned by ash::Shell.
66 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
68 // Owned by ash::AcceleratorController
69 TestScreenshotDelegate* test_screenshot_delegate_;
71 scoped_ptr<views::corewm::WMState> wm_state_;
73 // Check if DBus Thread Manager was initialized here.
74 bool dbus_thread_manager_initialized_;
76 DISALLOW_COPY_AND_ASSIGN(AshTestHelper);
82 #endif // ASH_TEST_ASH_TEST_HELPER_H_