| 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 "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 16 #include "ui/wm/public/window_types.h" | 16 #include "ui/wm/public/window_types.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 #include "ui/base/win/scoped_ole_initializer.h" | 19 #include "ui/base/win/scoped_ole_initializer.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class Rect; | 23 class Rect; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { |
| 27 namespace test { |
| 28 class EventGenerator; |
| 29 } |
| 30 } |
| 31 |
| 26 namespace aura { | 32 namespace aura { |
| 27 class RootWindow; | 33 class RootWindow; |
| 28 class Window; | 34 class Window; |
| 29 class WindowDelegate; | 35 class WindowDelegate; |
| 30 | |
| 31 namespace test { | |
| 32 class EventGenerator; | |
| 33 } // namespace test | |
| 34 } // namespace aura | 36 } // namespace aura |
| 35 | 37 |
| 36 namespace ash { | 38 namespace ash { |
| 37 class DisplayManager; | 39 class DisplayManager; |
| 38 | 40 |
| 39 namespace test { | 41 namespace test { |
| 40 | 42 |
| 41 class AshTestHelper; | 43 class AshTestHelper; |
| 42 class TestScreenshotDelegate; | 44 class TestScreenshotDelegate; |
| 43 class TestSystemTrayDelegate; | 45 class TestSystemTrayDelegate; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 ui::wm::WindowType type, | 81 ui::wm::WindowType type, |
| 80 int id, | 82 int id, |
| 81 const gfx::Rect& bounds); | 83 const gfx::Rect& bounds); |
| 82 | 84 |
| 83 // Attach |window| to the current shell's root window. | 85 // Attach |window| to the current shell's root window. |
| 84 void ParentWindowInPrimaryRootWindow(aura::Window* window); | 86 void ParentWindowInPrimaryRootWindow(aura::Window* window); |
| 85 | 87 |
| 86 // Returns the EventGenerator that uses screen coordinates and works | 88 // Returns the EventGenerator that uses screen coordinates and works |
| 87 // across multiple displays. It createse a new generator if it | 89 // across multiple displays. It createse a new generator if it |
| 88 // hasn't been created yet. | 90 // hasn't been created yet. |
| 89 aura::test::EventGenerator& GetEventGenerator(); | 91 ui::test::EventGenerator& GetEventGenerator(); |
| 90 | 92 |
| 91 protected: | 93 protected: |
| 92 enum UserSessionBlockReason { | 94 enum UserSessionBlockReason { |
| 93 FIRST_BLOCK_REASON, | 95 FIRST_BLOCK_REASON, |
| 94 BLOCKED_BY_LOCK_SCREEN = FIRST_BLOCK_REASON, | 96 BLOCKED_BY_LOCK_SCREEN = FIRST_BLOCK_REASON, |
| 95 BLOCKED_BY_LOGIN_SCREEN, | 97 BLOCKED_BY_LOGIN_SCREEN, |
| 96 BLOCKED_BY_USER_ADDING_SCREEN, | 98 BLOCKED_BY_USER_ADDING_SCREEN, |
| 97 NUMBER_OF_BLOCK_REASONS | 99 NUMBER_OF_BLOCK_REASONS |
| 98 }; | 100 }; |
| 99 | 101 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 125 void BlockUserSession(UserSessionBlockReason block_reason); | 127 void BlockUserSession(UserSessionBlockReason block_reason); |
| 126 void UnblockUserSession(); | 128 void UnblockUserSession(); |
| 127 | 129 |
| 128 private: | 130 private: |
| 129 bool setup_called_; | 131 bool setup_called_; |
| 130 bool teardown_called_; | 132 bool teardown_called_; |
| 131 // |SetUp()| doesn't activate session if this is set to false. | 133 // |SetUp()| doesn't activate session if this is set to false. |
| 132 bool start_session_; | 134 bool start_session_; |
| 133 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; | 135 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
| 134 scoped_ptr<AshTestHelper> ash_test_helper_; | 136 scoped_ptr<AshTestHelper> ash_test_helper_; |
| 135 scoped_ptr<aura::test::EventGenerator> event_generator_; | 137 scoped_ptr<ui::test::EventGenerator> event_generator_; |
| 136 #if defined(OS_WIN) | 138 #if defined(OS_WIN) |
| 137 // Note that the order is important here as ipc_thread_ should be destroyed | 139 // Note that the order is important here as ipc_thread_ should be destroyed |
| 138 // after metro_viewer_host_->channel_. | 140 // after metro_viewer_host_->channel_. |
| 139 scoped_ptr<base::Thread> ipc_thread_; | 141 scoped_ptr<base::Thread> ipc_thread_; |
| 140 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; | 142 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; |
| 141 ui::ScopedOleInitializer ole_initializer_; | 143 ui::ScopedOleInitializer ole_initializer_; |
| 142 #endif | 144 #endif |
| 143 | 145 |
| 144 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 146 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 class NoSessionAshTestBase : public AshTestBase { | 149 class NoSessionAshTestBase : public AshTestBase { |
| 148 public: | 150 public: |
| 149 NoSessionAshTestBase() { | 151 NoSessionAshTestBase() { |
| 150 set_start_session(false); | 152 set_start_session(false); |
| 151 } | 153 } |
| 152 virtual ~NoSessionAshTestBase() {} | 154 virtual ~NoSessionAshTestBase() {} |
| 153 | 155 |
| 154 private: | 156 private: |
| 155 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); | 157 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); |
| 156 }; | 158 }; |
| 157 | 159 |
| 158 } // namespace test | 160 } // namespace test |
| 159 } // namespace ash | 161 } // namespace ash |
| 160 | 162 |
| 161 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 163 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
| OLD | NEW |