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) | |
8 #include <ole2.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/root_window.h" | 11 #include "ui/aura/root_window.h" |
16 #include "ui/aura/test/test_activation_client.h" | 12 #include "ui/aura/test/test_activation_client.h" |
17 #include "ui/aura/test/test_stacking_client.h" | 13 #include "ui/aura/test/test_stacking_client.h" |
18 #include "ui/base/ime/input_method.h" | 14 #include "ui/base/ime/input_method.h" |
19 | 15 |
20 namespace { | 16 namespace { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 52 }; |
57 | 53 |
58 } // namespace | 54 } // namespace |
59 #endif | 55 #endif |
60 | 56 |
61 namespace views { | 57 namespace views { |
62 | 58 |
63 ViewsTestBase::ViewsTestBase() | 59 ViewsTestBase::ViewsTestBase() |
64 : setup_called_(false), | 60 : setup_called_(false), |
65 teardown_called_(false) { | 61 teardown_called_(false) { |
66 #if defined(OS_WIN) | |
67 OleInitialize(NULL); | |
68 #endif | |
69 #if defined(USE_AURA) | 62 #if defined(USE_AURA) |
70 test_input_method_.reset(new DummyInputMethod); | 63 test_input_method_.reset(new DummyInputMethod); |
71 #endif | 64 #endif |
72 } | 65 } |
73 | 66 |
74 ViewsTestBase::~ViewsTestBase() { | 67 ViewsTestBase::~ViewsTestBase() { |
75 #if defined(OS_WIN) | |
76 OleUninitialize(); | |
77 #endif | |
78 CHECK(setup_called_) | 68 CHECK(setup_called_) |
79 << "You have overridden SetUp but never called super class's SetUp"; | 69 << "You have overridden SetUp but never called super class's SetUp"; |
80 CHECK(teardown_called_) | 70 CHECK(teardown_called_) |
81 << "You have overrideen TearDown but never called super class's TearDown"; | 71 << "You have overrideen TearDown but never called super class's TearDown"; |
82 } | 72 } |
83 | 73 |
84 void ViewsTestBase::SetUp() { | 74 void ViewsTestBase::SetUp() { |
85 testing::Test::SetUp(); | 75 testing::Test::SetUp(); |
86 setup_called_ = true; | 76 setup_called_ = true; |
87 if (!views_delegate_.get()) | 77 if (!views_delegate_.get()) |
(...skipping 27 matching lines...) Expand all Loading... |
115 void ViewsTestBase::RunPendingMessages() { | 105 void ViewsTestBase::RunPendingMessages() { |
116 #if defined(USE_AURA) | 106 #if defined(USE_AURA) |
117 message_loop_.RunAllPendingWithDispatcher( | 107 message_loop_.RunAllPendingWithDispatcher( |
118 aura::Env::GetInstance()->GetDispatcher()); | 108 aura::Env::GetInstance()->GetDispatcher()); |
119 #else | 109 #else |
120 message_loop_.RunAllPending(); | 110 message_loop_.RunAllPending(); |
121 #endif | 111 #endif |
122 } | 112 } |
123 | 113 |
124 } // namespace views | 114 } // namespace views |
OLD | NEW |