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(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <ole2.h> | 8 #include <ole2.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/root_window.h" | 16 #include "ui/aura/root_window.h" |
16 #include "ui/aura/test/test_activation_client.h" | 17 #include "ui/aura/test/test_activation_client.h" |
17 #include "ui/aura/test/test_screen.h" | 18 #include "ui/aura/test/test_screen.h" |
18 #include "ui/aura/test/test_stacking_client.h" | 19 #include "ui/aura/test/test_stacking_client.h" |
19 #include "ui/base/ime/input_method.h" | 20 #include "ui/base/ime/input_method.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 class DummyInputMethod : public ui::InputMethod { | 24 class DummyInputMethod : public ui::InputMethod { |
24 public: | 25 public: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 << "You have overrideen TearDown but never called super class's TearDown"; | 83 << "You have overrideen TearDown but never called super class's TearDown"; |
83 } | 84 } |
84 | 85 |
85 void ViewsTestBase::SetUp() { | 86 void ViewsTestBase::SetUp() { |
86 testing::Test::SetUp(); | 87 testing::Test::SetUp(); |
87 setup_called_ = true; | 88 setup_called_ = true; |
88 if (!views_delegate_.get()) | 89 if (!views_delegate_.get()) |
89 views_delegate_.reset(new TestViewsDelegate()); | 90 views_delegate_.reset(new TestViewsDelegate()); |
90 #if defined(USE_AURA) | 91 #if defined(USE_AURA) |
91 root_window_.reset(new aura::RootWindow); | 92 root_window_.reset(new aura::RootWindow); |
| 93 aura::Env::GetInstance()->SetMonitorManager( |
| 94 aura::CreateSingleMonitorManager(root_window_.get())); |
92 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 95 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
93 root_window_->SetProperty( | 96 root_window_->SetProperty( |
94 aura::client::kRootWindowInputMethodKey, | 97 aura::client::kRootWindowInputMethodKey, |
95 test_input_method_.get()); | 98 test_input_method_.get()); |
96 test_activation_client_.reset( | 99 test_activation_client_.reset( |
97 new aura::test::TestActivationClient(root_window_.get())); | 100 new aura::test::TestActivationClient(root_window_.get())); |
98 test_stacking_client_.reset( | 101 test_stacking_client_.reset( |
99 new aura::test::TestStackingClient(root_window_.get())); | 102 new aura::test::TestStackingClient(root_window_.get())); |
100 #endif | 103 #endif |
101 } | 104 } |
(...skipping 15 matching lines...) Expand all Loading... |
117 void ViewsTestBase::RunPendingMessages() { | 120 void ViewsTestBase::RunPendingMessages() { |
118 #if defined(USE_AURA) | 121 #if defined(USE_AURA) |
119 message_loop_.RunAllPendingWithDispatcher( | 122 message_loop_.RunAllPendingWithDispatcher( |
120 aura::Env::GetInstance()->GetDispatcher()); | 123 aura::Env::GetInstance()->GetDispatcher()); |
121 #else | 124 #else |
122 message_loop_.RunAllPending(); | 125 message_loop_.RunAllPending(); |
123 #endif | 126 #endif |
124 } | 127 } |
125 | 128 |
126 } // namespace views | 129 } // namespace views |
OLD | NEW |