Make app list recommendations ignore KnownResults.
[chromium-blink-merge.git] / ash / test / ash_test_helper.h
blob36958bd199ac6608d5e6cc687a7e1be0b3e8659a
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;
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.
36 class AshTestHelper {
37 public:
38 explicit AshTestHelper(base::MessageLoopForUI* message_loop);
39 ~AshTestHelper();
41 // Creates the ash::Shell and performs associated initialization.
42 // Set |start_session| to true if the user should log in before
43 // the test is run.
44 void SetUp(bool start_session);
46 // Destroys the ash::Shell and performs associated cleanup.
47 void TearDown();
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();
75 private:
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_;
88 #endif
90 DISALLOW_COPY_AND_ASSIGN(AshTestHelper);
93 } // namespace test
94 } // namespace ash
96 #endif // ASH_TEST_ASH_TEST_HELPER_H_