| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "blimp/client/public/blimp_client_context.h" | 12 #include "blimp/client/public/blimp_client_context.h" |
| 13 #include "blimp/client/public/contents/blimp_contents.h" | 13 #include "blimp/client/public/contents/blimp_contents.h" |
| 14 #include "blimp/client/public/contents/blimp_contents_observer.h" | 14 #include "blimp/client/public/contents/blimp_contents_observer.h" |
| 15 #include "blimp/client/public/contents/blimp_contents_view.h" | 15 #include "blimp/client/public/contents/blimp_contents_view.h" |
| 16 #include "blimp/client/public/contents/blimp_navigation_controller.h" | 16 #include "blimp/client/public/contents/blimp_navigation_controller.h" |
| 17 #include "blimp/client/support/compositor/compositor_dependencies_impl.h" | 17 #include "blimp/client/support/compositor/compositor_dependencies_impl.h" |
| 18 #include "blimp/client/test/compositor/test_blimp_embedder_compositor.h" | 18 #include "blimp/client/test/compositor/test_blimp_embedder_compositor.h" |
| 19 #include "blimp/client/test/test_blimp_client_context_delegate.h" | 19 #include "blimp/client/test/test_blimp_client_context_delegate.h" |
| 20 #include "blimp/engine/browser_tests/blimp_browser_test.h" | 20 #include "blimp/engine/browser_tests/blimp_browser_test.h" |
| 21 #include "blimp/engine/browser_tests/blimp_contents_view_readback_helper.h" | 21 #include "blimp/engine/browser_tests/blimp_contents_view_readback_helper.h" |
| 22 #include "blimp/engine/browser_tests/waitable_content_pump.h" | 22 #include "blimp/engine/browser_tests/waitable_content_pump.h" |
| 23 #include "components/prefs/testing_pref_service.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/test/browser_test.h" | 25 #include "content/public/test/browser_test.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
| 28 #include "third_party/skia/include/core/SkColor.h" | 29 #include "third_party/skia/include/core/SkColor.h" |
| 29 #include "third_party/skia/include/core/SkGraphics.h" | 30 #include "third_party/skia/include/core/SkGraphics.h" |
| 30 #include "ui/gl/gl_implementation.h" | 31 #include "ui/gl/gl_implementation.h" |
| 31 #include "ui/gl/init/gl_factory.h" | 32 #include "ui/gl/init/gl_factory.h" |
| 32 | 33 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 base::MakeUnique<gl::DisableNullDrawGLBindings>(); | 76 base::MakeUnique<gl::DisableNullDrawGLBindings>(); |
| 76 | 77 |
| 77 std::unique_ptr<client::CompositorDependencies> compositor_dependencies = | 78 std::unique_ptr<client::CompositorDependencies> compositor_dependencies = |
| 78 base::MakeUnique<client::CompositorDependenciesImpl>(); | 79 base::MakeUnique<client::CompositorDependenciesImpl>(); |
| 79 | 80 |
| 80 compositor_ = base::MakeUnique<client::TestBlimpEmbedderCompositor>( | 81 compositor_ = base::MakeUnique<client::TestBlimpEmbedderCompositor>( |
| 81 compositor_dependencies.get()); | 82 compositor_dependencies.get()); |
| 82 | 83 |
| 83 delegate_ = base::MakeUnique<client::TestBlimpClientContextDelegate>(); | 84 delegate_ = base::MakeUnique<client::TestBlimpClientContextDelegate>(); |
| 84 | 85 |
| 86 client::BlimpClientContext::RegisterPrefs(prefs_.registry()); |
| 87 |
| 85 context_ = base::WrapUnique<client::BlimpClientContext>( | 88 context_ = base::WrapUnique<client::BlimpClientContext>( |
| 86 client::BlimpClientContext::Create( | 89 client::BlimpClientContext::Create( |
| 87 content::BrowserThread::GetTaskRunnerForThread( | 90 content::BrowserThread::GetTaskRunnerForThread( |
| 88 content::BrowserThread::IO), | 91 content::BrowserThread::IO), |
| 89 content::BrowserThread::GetTaskRunnerForThread( | 92 content::BrowserThread::GetTaskRunnerForThread( |
| 90 content::BrowserThread::FILE), | 93 content::BrowserThread::FILE), |
| 91 std::move(compositor_dependencies))); | 94 std::move(compositor_dependencies), &prefs_)); |
| 92 | 95 |
| 93 context_->SetDelegate(delegate_.get()); | 96 context_->SetDelegate(delegate_.get()); |
| 94 context_->ConnectWithAssignment(GetAssignment()); | 97 context_->ConnectWithAssignment(GetAssignment()); |
| 95 contents_ = context_->CreateBlimpContents(nullptr); | 98 contents_ = context_->CreateBlimpContents(nullptr); |
| 96 | 99 |
| 97 compositor_->SetContentLayer(contents_->GetView()->GetLayer()); | 100 compositor_->SetContentLayer(contents_->GetView()->GetLayer()); |
| 98 } | 101 } |
| 99 | 102 |
| 100 void TearDownOnMainThread() override { | 103 void TearDownOnMainThread() override { |
| 101 // Tear down the client objects. Ordering is important. | 104 // Tear down the client objects. Ordering is important. |
| 102 contents_.reset(); | 105 contents_.reset(); |
| 103 compositor_.reset(); | 106 compositor_.reset(); |
| 104 context_.reset(); | 107 context_.reset(); |
| 105 delegate_.reset(); | 108 delegate_.reset(); |
| 106 BlimpBrowserTest::TearDownOnMainThread(); | 109 BlimpBrowserTest::TearDownOnMainThread(); |
| 107 } | 110 } |
| 108 | 111 |
| 109 std::unique_ptr<client::BlimpClientContextDelegate> delegate_; | 112 std::unique_ptr<client::BlimpClientContextDelegate> delegate_; |
| 110 std::unique_ptr<client::BlimpClientContext> context_; | 113 std::unique_ptr<client::BlimpClientContext> context_; |
| 111 std::unique_ptr<client::TestBlimpEmbedderCompositor> compositor_; | 114 std::unique_ptr<client::TestBlimpEmbedderCompositor> compositor_; |
| 112 std::unique_ptr<client::BlimpContents> contents_; | 115 std::unique_ptr<client::BlimpContents> contents_; |
| 113 | 116 |
| 114 private: | 117 private: |
| 118 TestingPrefServiceSimple prefs_; |
| 115 std::unique_ptr<gl::DisableNullDrawGLBindings> scoped_enable_gl_bindings_; | 119 std::unique_ptr<gl::DisableNullDrawGLBindings> scoped_enable_gl_bindings_; |
| 116 | 120 |
| 117 DISALLOW_COPY_AND_ASSIGN(BlimpIntegrationTest); | 121 DISALLOW_COPY_AND_ASSIGN(BlimpIntegrationTest); |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 IN_PROC_BROWSER_TEST_F(BlimpIntegrationTest, TestFullRenderPath) { | 124 IN_PROC_BROWSER_TEST_F(BlimpIntegrationTest, TestFullRenderPath) { |
| 121 WaitableContentPump waiter; | 125 WaitableContentPump waiter; |
| 122 | 126 |
| 123 PageLoadWaitBlimpContentsObserver observer(contents_.get()); | 127 PageLoadWaitBlimpContentsObserver observer(contents_.get()); |
| 124 | 128 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 151 EXPECT_EQ(1, bitmap->width()); | 155 EXPECT_EQ(1, bitmap->width()); |
| 152 EXPECT_EQ(1, bitmap->height()); | 156 EXPECT_EQ(1, bitmap->height()); |
| 153 | 157 |
| 154 // Validate the readback bitmap contents. | 158 // Validate the readback bitmap contents. |
| 155 SkAutoLockPixels bitmap_lock(*bitmap); | 159 SkAutoLockPixels bitmap_lock(*bitmap); |
| 156 EXPECT_EQ(SK_ColorRED, bitmap->getColor(0, 0)); | 160 EXPECT_EQ(SK_ColorRED, bitmap->getColor(0, 0)); |
| 157 } | 161 } |
| 158 | 162 |
| 159 } // namespace | 163 } // namespace |
| 160 } // namespace blimp | 164 } // namespace blimp |
| OLD | NEW |