| Index: cc/trees/layer_tree_host_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
|
| index 91a2fd2590bb542b64a34cc9810245565e0c66bb..cac441a48bbb9afd4c95516038f821cbb9c53a1c 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -104,6 +104,7 @@ class LayerTreeHostImplTest : public testing::Test,
|
|
|
| virtual void TearDown() OVERRIDE {}
|
|
|
| + virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE {}
|
| virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {}
|
| virtual void DidSwapBuffersOnImplThread() OVERRIDE {}
|
| virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {}
|
| @@ -5213,9 +5214,14 @@ class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest {
|
| offscreen_context_provider_ = TestContextProvider::Create();
|
| }
|
|
|
| + virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE {
|
| + did_update_renderer_capabilities_ = true;
|
| + }
|
| +
|
| FakeOutputSurface* output_surface_;
|
| scoped_refptr<TestContextProvider> onscreen_context_provider_;
|
| scoped_refptr<TestContextProvider> offscreen_context_provider_;
|
| + bool did_update_renderer_capabilities_;
|
| };
|
|
|
|
|
| @@ -5227,20 +5233,24 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) {
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
|
|
| // DeferredInitialize and hardware draw.
|
| + did_update_renderer_capabilities_ = false;
|
| EXPECT_TRUE(output_surface_->InitializeAndSetContext3d(
|
| onscreen_context_provider_, offscreen_context_provider_));
|
| EXPECT_EQ(onscreen_context_provider_,
|
| host_impl_->output_surface()->context_provider());
|
| EXPECT_EQ(offscreen_context_provider_,
|
| host_impl_->offscreen_context_provider());
|
| + EXPECT_TRUE(did_update_renderer_capabilities_);
|
|
|
| // Defer intialized GL draw.
|
| DrawFrame();
|
|
|
| // Revert back to software.
|
| + did_update_renderer_capabilities_ = false;
|
| output_surface_->ReleaseGL();
|
| EXPECT_FALSE(host_impl_->output_surface()->context_provider());
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
| + EXPECT_TRUE(did_update_renderer_capabilities_);
|
|
|
| // Software draw again.
|
| DrawFrame();
|
| @@ -5258,15 +5268,20 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_0) {
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
|
|
| // DeferredInitialize fails.
|
| + did_update_renderer_capabilities_ = false;
|
| EXPECT_FALSE(output_surface_->InitializeAndSetContext3d(
|
| onscreen_context_provider_, offscreen_context_provider_));
|
| EXPECT_FALSE(host_impl_->output_surface()->context_provider());
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
| + EXPECT_FALSE(did_update_renderer_capabilities_);
|
|
|
| // Software draw again.
|
| DrawFrame();
|
| }
|
|
|
| +// TODO(boliu): After r239415, fails_OnscreenContext_1 and 2 are exactly the
|
| +// same as 0. They were supposed to test makeCurrent failing in the
|
| +// OutputSurface, LayerTreeHostImpl, and GLRenderer respectively.
|
| TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_1) {
|
| // Software draw.
|
| DrawFrame();
|
| @@ -5278,10 +5293,12 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_1) {
|
|
|
| EXPECT_FALSE(host_impl_->output_surface()->context_provider());
|
| // DeferredInitialize fails.
|
| + did_update_renderer_capabilities_ = false;
|
| EXPECT_FALSE(output_surface_->InitializeAndSetContext3d(
|
| onscreen_context_provider_, offscreen_context_provider_));
|
| EXPECT_FALSE(host_impl_->output_surface()->context_provider());
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
| + EXPECT_FALSE(did_update_renderer_capabilities_);
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_2) {
|
| @@ -5294,10 +5311,12 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_2) {
|
| onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true);
|
|
|
| // DeferredInitialize fails.
|
| + did_update_renderer_capabilities_ = false;
|
| EXPECT_FALSE(output_surface_->InitializeAndSetContext3d(
|
| onscreen_context_provider_, offscreen_context_provider_));
|
| EXPECT_FALSE(host_impl_->output_surface()->context_provider());
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
| + EXPECT_FALSE(did_update_renderer_capabilities_);
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OffscreenContext) {
|
| @@ -5311,10 +5330,12 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OffscreenContext) {
|
| onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true);
|
|
|
| // DeferredInitialize fails.
|
| + did_update_renderer_capabilities_ = false;
|
| EXPECT_FALSE(output_surface_->InitializeAndSetContext3d(
|
| onscreen_context_provider_, offscreen_context_provider_));
|
| EXPECT_FALSE(host_impl_->output_surface()->context_provider());
|
| EXPECT_FALSE(host_impl_->offscreen_context_provider());
|
| + EXPECT_FALSE(did_update_renderer_capabilities_);
|
| }
|
|
|
| // Checks that we have a non-0 default allocation if we pass a context that
|
|
|