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 #include "ui/views/test/views_test_base.h" | 5 #include "ui/views/test/views_test_base.h" |
6 | 6 |
7 #if defined(USE_ASH) | |
8 #include "ui/aura/test/test_screen.h" | |
9 #endif | |
10 | |
11 #if defined(USE_AURA) | 7 #if defined(USE_AURA) |
12 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
13 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
14 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
15 #include "ui/aura/monitor_manager.h" | 11 #include "ui/aura/monitor_manager.h" |
16 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
17 #include "ui/aura/single_monitor_manager.h" | 13 #include "ui/aura/single_monitor_manager.h" |
18 #include "ui/aura/test/test_activation_client.h" | 14 #include "ui/aura/test/test_activation_client.h" |
| 15 #include "ui/aura/test/test_screen.h" |
19 #include "ui/aura/test/test_stacking_client.h" | 16 #include "ui/aura/test/test_stacking_client.h" |
20 #include "ui/base/ime/input_method.h" | 17 #include "ui/base/ime/input_method.h" |
| 18 #include "ui/gfx/screen.h" |
21 | 19 |
22 namespace { | 20 namespace { |
23 | 21 |
24 class DummyInputMethod : public ui::InputMethod { | 22 class DummyInputMethod : public ui::InputMethod { |
25 public: | 23 public: |
26 DummyInputMethod() {} | 24 DummyInputMethod() {} |
27 virtual ~DummyInputMethod() {} | 25 virtual ~DummyInputMethod() {} |
28 | 26 |
29 // ui::InputMethod overrides: | 27 // ui::InputMethod overrides: |
30 virtual void SetDelegate( | 28 virtual void SetDelegate( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 76 } |
79 | 77 |
80 void ViewsTestBase::SetUp() { | 78 void ViewsTestBase::SetUp() { |
81 testing::Test::SetUp(); | 79 testing::Test::SetUp(); |
82 setup_called_ = true; | 80 setup_called_ = true; |
83 if (!views_delegate_.get()) | 81 if (!views_delegate_.get()) |
84 views_delegate_.reset(new TestViewsDelegate()); | 82 views_delegate_.reset(new TestViewsDelegate()); |
85 #if defined(USE_AURA) | 83 #if defined(USE_AURA) |
86 aura::Env::GetInstance()->SetMonitorManager(new aura::SingleMonitorManager); | 84 aura::Env::GetInstance()->SetMonitorManager(new aura::SingleMonitorManager); |
87 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); | 85 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); |
88 #if defined(USE_ASH) | |
89 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 86 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
90 #endif // USE_ASH | |
91 root_window_->SetProperty( | 87 root_window_->SetProperty( |
92 aura::client::kRootWindowInputMethodKey, | 88 aura::client::kRootWindowInputMethodKey, |
93 test_input_method_.get()); | 89 test_input_method_.get()); |
94 test_activation_client_.reset( | 90 test_activation_client_.reset( |
95 new aura::test::TestActivationClient(root_window_.get())); | 91 new aura::test::TestActivationClient(root_window_.get())); |
96 test_stacking_client_.reset( | 92 test_stacking_client_.reset( |
97 new aura::test::TestStackingClient(root_window_.get())); | 93 new aura::test::TestStackingClient(root_window_.get())); |
98 #endif // USE_AURA | 94 #endif // USE_AURA |
99 } | 95 } |
100 | 96 |
(...skipping 14 matching lines...) Expand all Loading... |
115 void ViewsTestBase::RunPendingMessages() { | 111 void ViewsTestBase::RunPendingMessages() { |
116 #if defined(USE_AURA) | 112 #if defined(USE_AURA) |
117 message_loop_.RunAllPendingWithDispatcher( | 113 message_loop_.RunAllPendingWithDispatcher( |
118 aura::Env::GetInstance()->GetDispatcher()); | 114 aura::Env::GetInstance()->GetDispatcher()); |
119 #else | 115 #else |
120 message_loop_.RunAllPending(); | 116 message_loop_.RunAllPending(); |
121 #endif | 117 #endif |
122 } | 118 } |
123 | 119 |
124 } // namespace views | 120 } // namespace views |
OLD | NEW |