| 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/aura/test/aura_test_helper.h" | 5 #include "ui/aura/test/aura_test_helper.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/default_activation_client.h" | 10 #include "ui/aura/client/default_activation_client.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #endif | 55 #endif |
| 56 } | 56 } |
| 57 | 57 |
| 58 AuraTestHelper::~AuraTestHelper() { | 58 AuraTestHelper::~AuraTestHelper() { |
| 59 CHECK(setup_called_) | 59 CHECK(setup_called_) |
| 60 << "AuraTestHelper::SetUp() never called."; | 60 << "AuraTestHelper::SetUp() never called."; |
| 61 CHECK(teardown_called_) | 61 CHECK(teardown_called_) |
| 62 << "AuraTestHelper::TearDown() never called."; | 62 << "AuraTestHelper::TearDown() never called."; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void AuraTestHelper::SetUp() { | 65 void AuraTestHelper::SetUp(bool allow_test_contexts) { |
| 66 setup_called_ = true; | 66 setup_called_ = true; |
| 67 | 67 |
| 68 // The ContextFactory must exist before any Compositors are created. | 68 // The ContextFactory must exist before any Compositors are created. |
| 69 bool allow_test_contexts = true; | |
| 70 ui::InitializeContextFactoryForTests(allow_test_contexts); | 69 ui::InitializeContextFactoryForTests(allow_test_contexts); |
| 71 | 70 |
| 72 Env::CreateInstance(); | 71 Env::CreateInstance(); |
| 73 // Unit tests generally don't want to query the system, rather use the state | 72 // Unit tests generally don't want to query the system, rather use the state |
| 74 // from RootWindow. | 73 // from RootWindow. |
| 75 EnvTestHelper(Env::GetInstance()).SetInputStateLookup( | 74 EnvTestHelper(Env::GetInstance()).SetInputStateLookup( |
| 76 scoped_ptr<InputStateLookup>()); | 75 scoped_ptr<InputStateLookup>()); |
| 77 | 76 |
| 78 ui::InitializeInputMethodForTesting(); | 77 ui::InitializeInputMethodForTesting(); |
| 79 | 78 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 121 |
| 123 void AuraTestHelper::RunAllPendingInMessageLoop() { | 122 void AuraTestHelper::RunAllPendingInMessageLoop() { |
| 124 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 123 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
| 125 // use run_loop.QuitClosure(). | 124 // use run_loop.QuitClosure(). |
| 126 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); | 125 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); |
| 127 run_loop.RunUntilIdle(); | 126 run_loop.RunUntilIdle(); |
| 128 } | 127 } |
| 129 | 128 |
| 130 } // namespace test | 129 } // namespace test |
| 131 } // namespace aura | 130 } // namespace aura |
| OLD | NEW |