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
;
30 class TestScreenshotDelegate
;
31 class TestShellDelegate
;
32 class TestSessionStateDelegate
;
34 // A helper class that does common initialization required for Ash. Creates a
35 // root window and an ash::Shell instance with a test delegate.
38 explicit AshTestHelper(base::MessageLoopForUI
* message_loop
);
41 // Creates the ash::Shell and performs associated initialization.
42 // Set |start_session| to true if the user should log in before
44 void SetUp(bool start_session
);
46 // Destroys the ash::Shell and performs associated cleanup.
49 // Returns a root Window. Usually this is the active root Window, but that
50 // method can return NULL sometimes, and in those cases, we fall back on the
51 // primary root Window.
52 aura::Window
* CurrentContext();
54 void RunAllPendingInMessageLoop();
56 static TestSessionStateDelegate
* GetTestSessionStateDelegate();
58 base::MessageLoopForUI
* message_loop() { return message_loop_
; }
59 TestShellDelegate
* test_shell_delegate() { return test_shell_delegate_
; }
60 void set_test_shell_delegate(TestShellDelegate
* test_shell_delegate
) {
61 test_shell_delegate_
= test_shell_delegate
;
63 TestScreenshotDelegate
* test_screenshot_delegate() {
64 return test_screenshot_delegate_
;
67 // True if the running environment supports multiple displays,
68 // or false otherwise (e.g. win8 bot).
69 static bool SupportsMultipleDisplays();
71 // True if the running environment supports host window resize,
72 // or false otherwise (e.g. win8 bot).
73 static bool SupportsHostWindowResize();
76 base::MessageLoopForUI
* message_loop_
; // Not owned.
77 TestShellDelegate
* test_shell_delegate_
; // Owned by ash::Shell.
78 scoped_ptr
<ui::ScopedAnimationDurationScaleMode
> zero_duration_mode_
;
80 // Owned by ash::AcceleratorController
81 TestScreenshotDelegate
* test_screenshot_delegate_
;
83 scoped_ptr
<views::ViewsDelegate
> views_delegate_
;
85 #if defined(OS_CHROMEOS)
86 // Check if DBus Thread Manager was initialized here.
87 bool dbus_thread_manager_initialized_
;
90 DISALLOW_COPY_AND_ASSIGN(AshTestHelper
);
96 #endif // ASH_TEST_ASH_TEST_HELPER_H_