| 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 #include "base/run_loop.h" |
| 8 |
| 7 #if defined(USE_AURA) | 9 #if defined(USE_AURA) |
| 8 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| 9 #include "ui/aura/test/aura_test_helper.h" | 11 #include "ui/aura/test/aura_test_helper.h" |
| 10 #endif | 12 #endif |
| 11 | 13 |
| 12 namespace views { | 14 namespace views { |
| 13 | 15 |
| 14 ViewsTestBase::ViewsTestBase() | 16 ViewsTestBase::ViewsTestBase() |
| 15 : setup_called_(false), | 17 : setup_called_(false), |
| 16 teardown_called_(false) { | 18 teardown_called_(false) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 40 RunPendingMessages(); | 42 RunPendingMessages(); |
| 41 teardown_called_ = true; | 43 teardown_called_ = true; |
| 42 views_delegate_.reset(); | 44 views_delegate_.reset(); |
| 43 testing::Test::TearDown(); | 45 testing::Test::TearDown(); |
| 44 #if defined(USE_AURA) | 46 #if defined(USE_AURA) |
| 45 aura_test_helper_->TearDown(); | 47 aura_test_helper_->TearDown(); |
| 46 #endif | 48 #endif |
| 47 } | 49 } |
| 48 | 50 |
| 49 void ViewsTestBase::RunPendingMessages() { | 51 void ViewsTestBase::RunPendingMessages() { |
| 52 base::RunLoop run_loop; |
| 50 #if defined(USE_AURA) | 53 #if defined(USE_AURA) |
| 51 message_loop_.RunAllPendingWithDispatcher( | 54 run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher()); |
| 52 aura::Env::GetInstance()->GetDispatcher()); | |
| 53 #else | |
| 54 message_loop_.RunAllPending(); | |
| 55 #endif | 55 #endif |
| 56 run_loop.RunUntilIdle(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 } // namespace views | 59 } // namespace views |
| OLD | NEW |