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
;
33 // A helper class that does common initialization required for Ash. Creates a
34 // root window and an ash::Shell instance with a test delegate.
37 explicit AshTestHelper(base::MessageLoopForUI
* message_loop
);
40 // Creates the ash::Shell and performs associated initialization.
41 // Set |start_session| to true if the user should log in before
43 void SetUp(bool start_session
);
45 // Destroys the ash::Shell and performs associated cleanup.
48 // Returns a root Window. Usually this is the active root Window, but that
49 // method can return NULL sometimes, and in those cases, we fall back on the
50 // primary root Window.
51 aura::Window
* CurrentContext();
53 void RunAllPendingInMessageLoop();
55 base::MessageLoopForUI
* message_loop() { return message_loop_
; }
56 TestShellDelegate
* test_shell_delegate() { return test_shell_delegate_
; }
57 void set_test_shell_delegate(TestShellDelegate
* test_shell_delegate
) {
58 test_shell_delegate_
= test_shell_delegate
;
60 TestScreenshotDelegate
* test_screenshot_delegate() {
61 return test_screenshot_delegate_
;
64 // True if the running environment supports multiple displays,
65 // or false otherwise (e.g. win8 bot).
66 static bool SupportsMultipleDisplays();
68 // True if the running environment supports host window resize,
69 // or false otherwise (e.g. win8 bot).
70 static bool SupportsHostWindowResize();
73 base::MessageLoopForUI
* message_loop_
; // Not owned.
74 TestShellDelegate
* test_shell_delegate_
; // Owned by ash::Shell.
75 scoped_ptr
<ui::ScopedAnimationDurationScaleMode
> zero_duration_mode_
;
77 // Owned by ash::AcceleratorController
78 TestScreenshotDelegate
* test_screenshot_delegate_
;
80 scoped_ptr
<views::ViewsDelegate
> views_delegate_
;
82 #if defined(OS_CHROMEOS)
83 // Check if DBus Thread Manager was initialized here.
84 bool dbus_thread_manager_initialized_
;
87 DISALLOW_COPY_AND_ASSIGN(AshTestHelper
);
93 #endif // ASH_TEST_ASH_TEST_HELPER_H_