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