Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3156)

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 151093005: cc: Update Main RendererCapabilities on DeferredInitialize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add back a DCHECK that was accdentially deleted Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56eaecca4e2da74f1d308098af38db97d10f5803..ada5637e381f06228aa2e0ebe58dbfdeb428a041 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 {}
@@ -5247,9 +5248,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_;
};
@@ -5261,20 +5267,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();
@@ -5292,15 +5302,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();
@@ -5312,10 +5327,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) {
@@ -5328,10 +5345,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) {
@@ -5345,10 +5364,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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698