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 |
11 #include "ui/aura/desktop.h" | 11 #include "ui/aura/root_window.h" |
12 #include "ui/aura/test/test_stacking_client.h" | 12 #include "ui/aura/test/test_stacking_client.h" |
13 | 13 |
14 namespace aura { | 14 namespace aura { |
15 namespace test { | 15 namespace test { |
16 | 16 |
17 AuraTestBase::AuraTestBase() | 17 AuraTestBase::AuraTestBase() |
18 : setup_called_(false), | 18 : setup_called_(false), |
19 teardown_called_(false) { | 19 teardown_called_(false) { |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
21 OleInitialize(NULL); | 21 OleInitialize(NULL); |
22 #endif | 22 #endif |
23 | 23 |
24 // TestStackingClient is owned by the desktop. | 24 // TestStackingClient is owned by the root window. |
25 new TestStackingClient(); | 25 new TestStackingClient(); |
26 Desktop::GetInstance()->Show(); | 26 RootWindow::GetInstance()->Show(); |
27 Desktop::GetInstance()->SetHostSize(gfx::Size(600, 600)); | 27 RootWindow::GetInstance()->SetHostSize(gfx::Size(600, 600)); |
28 } | 28 } |
29 | 29 |
30 AuraTestBase::~AuraTestBase() { | 30 AuraTestBase::~AuraTestBase() { |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 OleUninitialize(); | 32 OleUninitialize(); |
33 #endif | 33 #endif |
34 CHECK(setup_called_) | 34 CHECK(setup_called_) |
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 RootWindow 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::DeleteInstance(); | 45 aura::RootWindow::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::RootWindow::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 RootWindow::GetInstance()->GetDispatcher()); |
66 } | 66 } |
67 | 67 |
68 } // namespace test | 68 } // namespace test |
69 } // namespace aura | 69 } // namespace aura |
OLD | NEW |