OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_TEST_ASH_TEST_BASE_H_ | 5 #ifndef ASH_TEST_ASH_TEST_BASE_H_ |
6 #define ASH_TEST_ASH_TEST_BASE_H_ | 6 #define ASH_TEST_ASH_TEST_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/aura/client/window_types.h" | 15 #include "ui/aura/client/window_types.h" |
16 #include "ui/views/test/test_views_delegate.h" | 16 #include "ui/views/test/test_views_delegate.h" |
17 | 17 |
18 namespace aura { | 18 namespace aura { |
19 class Window; | 19 class Window; |
20 class WindowDelegate; | 20 class WindowDelegate; |
21 } | 21 |
| 22 namespace test { |
| 23 class EventGenerator; |
| 24 } // namespace test |
| 25 } // namespace aura |
22 | 26 |
23 namespace ash { | 27 namespace ash { |
24 namespace internal { | 28 namespace internal { |
25 class DisplayManager; | 29 class DisplayManager; |
26 } // internal | 30 } // namespace internal |
27 | 31 |
28 namespace test { | 32 namespace test { |
29 | 33 |
30 class TestShellDelegate; | 34 class TestShellDelegate; |
31 | 35 |
32 class AshTestViewsDelegate : public views::TestViewsDelegate { | 36 class AshTestViewsDelegate : public views::TestViewsDelegate { |
33 public: | 37 public: |
34 // Overriden from TestViewsDelegate. | 38 // Overriden from TestViewsDelegate. |
35 virtual content::WebContents* CreateWebContents( | 39 virtual content::WebContents* CreateWebContents( |
36 content::BrowserContext* browser_context, | 40 content::BrowserContext* browser_context, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const gfx::Rect& bounds); | 78 const gfx::Rect& bounds); |
75 aura::Window* CreateTestWindowInShellWithDelegateAndType( | 79 aura::Window* CreateTestWindowInShellWithDelegateAndType( |
76 aura::WindowDelegate* delegate, | 80 aura::WindowDelegate* delegate, |
77 aura::client::WindowType type, | 81 aura::client::WindowType type, |
78 int id, | 82 int id, |
79 const gfx::Rect& bounds); | 83 const gfx::Rect& bounds); |
80 | 84 |
81 // Attach |window| to the current shell's root window. | 85 // Attach |window| to the current shell's root window. |
82 void SetDefaultParentByPrimaryRootWindow(aura::Window* window); | 86 void SetDefaultParentByPrimaryRootWindow(aura::Window* window); |
83 | 87 |
| 88 // Returns the EventGenerator that uses screen coordinates and works |
| 89 // across multiple displays. It createse a new generator if it |
| 90 // hasn't been created yet. |
| 91 aura::test::EventGenerator& GetEventGenerator(); |
| 92 |
84 protected: | 93 protected: |
85 void RunAllPendingInMessageLoop(); | 94 void RunAllPendingInMessageLoop(); |
86 | 95 |
87 // Utility methods to emulate user logged in or not, session started or not | 96 // Utility methods to emulate user logged in or not, session started or not |
88 // and user able to lock screen or not cases. | 97 // and user able to lock screen or not cases. |
89 void SetSessionStarted(bool session_started); | 98 void SetSessionStarted(bool session_started); |
90 void SetUserLoggedIn(bool user_logged_in); | 99 void SetUserLoggedIn(bool user_logged_in); |
91 void SetCanLockScreen(bool can_lock_screen); | 100 void SetCanLockScreen(bool can_lock_screen); |
92 | 101 |
93 private: | 102 private: |
94 MessageLoopForUI message_loop_; | 103 MessageLoopForUI message_loop_; |
95 | 104 |
96 TestShellDelegate* test_shell_delegate_; | 105 TestShellDelegate* test_shell_delegate_; |
97 | 106 |
| 107 scoped_ptr<aura::test::EventGenerator> event_generator_; |
| 108 |
98 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 109 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
99 }; | 110 }; |
100 | 111 |
101 } // namespace test | 112 } // namespace test |
102 } // namespace ash | 113 } // namespace ash |
103 | 114 |
104 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 115 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
OLD | NEW |