Chromium Code Reviews| 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 TestingPrefServiceSimple prefs; | |
|
David Trainor- moved to gerrit
2016/09/27 04:10:07
Won't this die right after this call? Move this t
Menglin
2016/09/30 23:48:57
Right. thank you
| |
| 87 client::BlimpClientContext::RegisterPrefs(prefs.registry()); | |
| 88 | |
| 85 context_ = base::WrapUnique<client::BlimpClientContext>( | 89 context_ = base::WrapUnique<client::BlimpClientContext>( |
| 86 client::BlimpClientContext::Create( | 90 client::BlimpClientContext::Create( |
| 87 content::BrowserThread::GetTaskRunnerForThread( | 91 content::BrowserThread::GetTaskRunnerForThread( |
| 88 content::BrowserThread::IO), | 92 content::BrowserThread::IO), |
| 89 content::BrowserThread::GetTaskRunnerForThread( | 93 content::BrowserThread::GetTaskRunnerForThread( |
| 90 content::BrowserThread::FILE), | 94 content::BrowserThread::FILE), |
| 91 std::move(compositor_dependencies))); | 95 std::move(compositor_dependencies), &prefs)); |
| 92 | 96 |
| 93 context_->SetDelegate(delegate_.get()); | 97 context_->SetDelegate(delegate_.get()); |
| 94 context_->ConnectWithAssignment(GetAssignment()); | 98 context_->ConnectWithAssignment(GetAssignment()); |
| 95 contents_ = context_->CreateBlimpContents(nullptr); | 99 contents_ = context_->CreateBlimpContents(nullptr); |
| 96 | 100 |
| 97 compositor_->SetContentLayer(contents_->GetView()->GetLayer()); | 101 compositor_->SetContentLayer(contents_->GetView()->GetLayer()); |
| 98 } | 102 } |
| 99 | 103 |
| 100 void TearDownOnMainThread() override { | 104 void TearDownOnMainThread() override { |
| 101 // Tear down the client objects. Ordering is important. | 105 // Tear down the client objects. Ordering is important. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |