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