OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/test/athena_test_base.h" | 5 #include "athena/test/athena_test_base.h" |
6 | 6 |
| 7 #include "athena/env/public/athena_env.h" |
7 #include "athena/screen/public/screen_manager.h" | 8 #include "athena/screen/public/screen_manager.h" |
8 #include "athena/test/athena_test_helper.h" | 9 #include "athena/test/athena_test_helper.h" |
9 #include "ui/aura/client/window_tree_client.h" | 10 #include "ui/aura/client/window_tree_client.h" |
10 #include "ui/aura/test/event_generator_delegate_aura.h" | 11 #include "ui/aura/test/event_generator_delegate_aura.h" |
11 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
12 #include "ui/compositor/test/context_factories_for_test.h" | 13 #include "ui/compositor/test/context_factories_for_test.h" |
13 | 14 |
14 #if defined(USE_X11) | 15 #if defined(USE_X11) |
15 #include "ui/aura/window_tree_host_x11.h" | 16 #include "ui/aura/window_tree_host_x11.h" |
16 #endif | 17 #endif |
(...skipping 23 matching lines...) Expand all Loading... |
40 | 41 |
41 helper_.reset(new AthenaTestHelper(&message_loop_)); | 42 helper_.reset(new AthenaTestHelper(&message_loop_)); |
42 #if defined(USE_X11) | 43 #if defined(USE_X11) |
43 aura::test::SetUseOverrideRedirectWindowByDefault(true); | 44 aura::test::SetUseOverrideRedirectWindowByDefault(true); |
44 #endif | 45 #endif |
45 aura::test::InitializeAuraEventGeneratorDelegate(); | 46 aura::test::InitializeAuraEventGeneratorDelegate(); |
46 helper_->SetUp(context_factory); | 47 helper_->SetUp(context_factory); |
47 } | 48 } |
48 | 49 |
49 void AthenaTestBase::TearDown() { | 50 void AthenaTestBase::TearDown() { |
| 51 AthenaEnv::Get()->OnTerminating(); |
| 52 |
50 teardown_called_ = true; | 53 teardown_called_ = true; |
51 | 54 |
52 // Flush the message loop because we have pending release tasks | 55 // Flush the message loop because we have pending release tasks |
53 // and these tasks if un-executed would upset Valgrind. | 56 // and these tasks if un-executed would upset Valgrind. |
54 RunAllPendingInMessageLoop(); | 57 RunAllPendingInMessageLoop(); |
55 | 58 |
56 helper_->TearDown(); | 59 helper_->TearDown(); |
57 ui::TerminateContextFactoryForTests(); | 60 ui::TerminateContextFactoryForTests(); |
58 testing::Test::TearDown(); | 61 testing::Test::TearDown(); |
59 } | 62 } |
60 | 63 |
61 void AthenaTestBase::RunAllPendingInMessageLoop() { | 64 void AthenaTestBase::RunAllPendingInMessageLoop() { |
62 helper_->RunAllPendingInMessageLoop(); | 65 helper_->RunAllPendingInMessageLoop(); |
63 } | 66 } |
64 | 67 |
65 scoped_ptr<aura::Window> AthenaTestBase::CreateTestWindow( | 68 scoped_ptr<aura::Window> AthenaTestBase::CreateTestWindow( |
66 aura::WindowDelegate* delegate, | 69 aura::WindowDelegate* delegate, |
67 const gfx::Rect& bounds) { | 70 const gfx::Rect& bounds) { |
68 scoped_ptr<aura::Window> window(new aura::Window(delegate)); | 71 scoped_ptr<aura::Window> window(new aura::Window(delegate)); |
69 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 72 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
70 window->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 73 window->Init(aura::WINDOW_LAYER_SOLID_COLOR); |
71 aura::client::ParentWindowWithContext( | 74 aura::client::ParentWindowWithContext( |
72 window.get(), ScreenManager::Get()->GetContext(), bounds); | 75 window.get(), ScreenManager::Get()->GetContext(), bounds); |
73 return window.Pass(); | 76 return window.Pass(); |
74 } | 77 } |
75 | 78 |
76 } // namespace test | 79 } // namespace test |
77 } // namespace athena | 80 } // namespace athena |
OLD | NEW |