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