OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/aura/test/aura_test_base.h" | 5 #include "ui/aura/test/aura_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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 << "You have overridden SetUp but never called super class's SetUp"; | 35 << "You have overridden SetUp but never called super class's SetUp"; |
36 CHECK(teardown_called_) | 36 CHECK(teardown_called_) |
37 << "You have overridden TearDown but never called super class's TearDown"; | 37 << "You have overridden TearDown but never called super class's TearDown"; |
38 | 38 |
39 // Flush the message loop because we have pending release tasks | 39 // Flush the message loop because we have pending release tasks |
40 // and these tasks if un-executed would upset Valgrind. | 40 // and these tasks if un-executed would upset Valgrind. |
41 RunAllPendingInMessageLoop(); | 41 RunAllPendingInMessageLoop(); |
42 | 42 |
43 // Ensure that we don't use the previously-allocated static Desktop object | 43 // Ensure that we don't use the previously-allocated static Desktop object |
44 // later -- on Linux, it holds a reference to our message loop's X connection. | 44 // later -- on Linux, it holds a reference to our message loop's X connection. |
45 aura::Desktop::DeleteInstanceForTesting(); | 45 aura::Desktop::DeleteInstance(); |
46 } | 46 } |
47 | 47 |
48 TestStackingClient* AuraTestBase::GetTestStackingClient() { | 48 TestStackingClient* AuraTestBase::GetTestStackingClient() { |
49 return static_cast<TestStackingClient*>( | 49 return static_cast<TestStackingClient*>( |
50 aura::Desktop::GetInstance()->stacking_client()); | 50 aura::Desktop::GetInstance()->stacking_client()); |
51 } | 51 } |
52 | 52 |
53 void AuraTestBase::SetUp() { | 53 void AuraTestBase::SetUp() { |
54 testing::Test::SetUp(); | 54 testing::Test::SetUp(); |
55 setup_called_ = true; | 55 setup_called_ = true; |
56 } | 56 } |
57 | 57 |
58 void AuraTestBase::TearDown() { | 58 void AuraTestBase::TearDown() { |
59 teardown_called_ = true; | 59 teardown_called_ = true; |
60 testing::Test::TearDown(); | 60 testing::Test::TearDown(); |
61 } | 61 } |
62 | 62 |
63 void AuraTestBase::RunAllPendingInMessageLoop() { | 63 void AuraTestBase::RunAllPendingInMessageLoop() { |
64 message_loop_.RunAllPendingWithDispatcher( | 64 message_loop_.RunAllPendingWithDispatcher( |
65 Desktop::GetInstance()->GetDispatcher()); | 65 Desktop::GetInstance()->GetDispatcher()); |
66 } | 66 } |
67 | 67 |
68 } // namespace test | 68 } // namespace test |
69 } // namespace aura | 69 } // namespace aura |
OLD | NEW |