| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/scoped_views_test_helper.h" | 5 #include "ui/views/test/scoped_views_test_helper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 old_context_factory = aura::Env::GetInstance()->context_factory(); | 35 old_context_factory = aura::Env::GetInstance()->context_factory(); |
| 36 DCHECK(old_context_factory); | 36 DCHECK(old_context_factory); |
| 37 } | 37 } |
| 38 #endif | 38 #endif |
| 39 ui::ContextFactory* context_factory = | 39 ui::ContextFactory* context_factory = |
| 40 ui::InitializeContextFactoryForTests(enable_pixel_output); | 40 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 41 views_delegate_->set_context_factory(context_factory); | 41 views_delegate_->set_context_factory(context_factory); |
| 42 | 42 |
| 43 test_helper_.reset(ViewsTestHelper::Create(base::MessageLoopForUI::current(), | 43 test_helper_.reset(ViewsTestHelper::Create(base::MessageLoopForUI::current(), |
| 44 context_factory)); | 44 context_factory)); |
| 45 platform_test_helper_->OnTestHelperCreated(test_helper_.get()); |
| 45 test_helper_->SetUp(); | 46 test_helper_->SetUp(); |
| 46 | 47 |
| 47 #if defined(USE_AURA) | 48 #if defined(USE_AURA) |
| 48 // When running inside mus, the context-factory from | 49 // When running inside mus, the context-factory from |
| 49 // ui::InitializeContextFactoryForTests() is only needed for the default | 50 // ui::InitializeContextFactoryForTests() is only needed for the default |
| 50 // WindowTreeHost instance created by TestScreen. After that, the | 51 // WindowTreeHost instance created by TestScreen. After that, the |
| 51 // context-factory is used when creating Widgets (to set-up the compositor for | 52 // context-factory is used when creating Widgets (to set-up the compositor for |
| 52 // the corresponding ui::Windows). So restore the context-factory (which | 53 // the corresponding ui::Windows). So restore the context-factory (which |
| 53 // WindowManagerConnection would have set up), so that NativeWidgetMus | 54 // WindowManagerConnection would have set up), so that NativeWidgetMus |
| 54 // installs the correct context-factory that can talk to mus. | 55 // installs the correct context-factory that can talk to mus. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 platform_test_helper_.reset(); | 72 platform_test_helper_.reset(); |
| 72 | 73 |
| 73 ui::TerminateContextFactoryForTests(); | 74 ui::TerminateContextFactoryForTests(); |
| 74 } | 75 } |
| 75 | 76 |
| 76 gfx::NativeWindow ScopedViewsTestHelper::GetContext() { | 77 gfx::NativeWindow ScopedViewsTestHelper::GetContext() { |
| 77 return test_helper_->GetContext(); | 78 return test_helper_->GetContext(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace views | 81 } // namespace views |
| OLD | NEW |