usb_gadget: Switch to official Google product IDs.
[chromium-blink-merge.git] / ash / test / ash_test_helper.h
blobb42cc7254347724c42ff819aa02bb99684c3be6c
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"
11 namespace aura {
12 class Window;
13 } // namespace aura
15 namespace base {
16 class MessageLoopForUI;
17 } // namespace base
19 namespace ui {
20 class ScopedAnimationDurationScaleMode;
21 } // namespace ui
23 namespace views {
24 class ViewsDelegate;
27 namespace ash {
28 namespace test {
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.
35 class AshTestHelper {
36 public:
37 explicit AshTestHelper(base::MessageLoopForUI* message_loop);
38 ~AshTestHelper();
40 // Creates the ash::Shell and performs associated initialization.
41 // Set |start_session| to true if the user should log in before
42 // the test is run.
43 void SetUp(bool start_session);
45 // Destroys the ash::Shell and performs associated cleanup.
46 void TearDown();
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();
72 private:
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 // Check if DBus Thread Manager was initialized here.
83 bool dbus_thread_manager_initialized_;
85 DISALLOW_COPY_AND_ASSIGN(AshTestHelper);
88 } // namespace test
89 } // namespace ash
91 #endif // ASH_TEST_ASH_TEST_HELPER_H_