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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 916723002: cc: Add threaded GPU rasterization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update raster skewport setting. Rebase and update test context provider to match latest Skia. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 6608 matching lines...) Expand 10 before | Expand all | Expand 10 after
6619 6619
6620 6620
6621 TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) { 6621 TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) {
6622 // Software draw. 6622 // Software draw.
6623 DrawFrame(); 6623 DrawFrame();
6624 6624
6625 EXPECT_FALSE(host_impl_->output_surface()->context_provider()); 6625 EXPECT_FALSE(host_impl_->output_surface()->context_provider());
6626 6626
6627 // DeferredInitialize and hardware draw. 6627 // DeferredInitialize and hardware draw.
6628 did_update_renderer_capabilities_ = false; 6628 did_update_renderer_capabilities_ = false;
6629 EXPECT_TRUE( 6629 EXPECT_TRUE(output_surface_->InitializeAndSetContext3d(
6630 output_surface_->InitializeAndSetContext3d(onscreen_context_provider_)); 6630 onscreen_context_provider_, nullptr));
6631 EXPECT_EQ(onscreen_context_provider_.get(), 6631 EXPECT_EQ(onscreen_context_provider_.get(),
6632 host_impl_->output_surface()->context_provider()); 6632 host_impl_->output_surface()->context_provider());
6633 EXPECT_TRUE(did_update_renderer_capabilities_); 6633 EXPECT_TRUE(did_update_renderer_capabilities_);
6634 6634
6635 // Defer intialized GL draw. 6635 // Defer intialized GL draw.
6636 DrawFrame(); 6636 DrawFrame();
6637 6637
6638 // Revert back to software. 6638 // Revert back to software.
6639 did_update_renderer_capabilities_ = false; 6639 did_update_renderer_capabilities_ = false;
6640 output_surface_->ReleaseGL(); 6640 output_surface_->ReleaseGL();
6641 EXPECT_FALSE(host_impl_->output_surface()->context_provider()); 6641 EXPECT_FALSE(host_impl_->output_surface()->context_provider());
6642 EXPECT_TRUE(did_update_renderer_capabilities_); 6642 EXPECT_TRUE(did_update_renderer_capabilities_);
6643 6643
6644 // Software draw again. 6644 // Software draw again.
6645 DrawFrame(); 6645 DrawFrame();
6646 } 6646 }
6647 6647
6648 TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails) { 6648 TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails) {
6649 // Software draw. 6649 // Software draw.
6650 DrawFrame(); 6650 DrawFrame();
6651 6651
6652 // Fail initialization of the onscreen context before the OutputSurface binds 6652 // Fail initialization of the onscreen context before the OutputSurface binds
6653 // it to the thread. 6653 // it to the thread.
6654 onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true); 6654 onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true);
6655 6655
6656 EXPECT_FALSE(host_impl_->output_surface()->context_provider()); 6656 EXPECT_FALSE(host_impl_->output_surface()->context_provider());
6657 6657
6658 // DeferredInitialize fails. 6658 // DeferredInitialize fails.
6659 did_update_renderer_capabilities_ = false; 6659 did_update_renderer_capabilities_ = false;
6660 EXPECT_FALSE( 6660 EXPECT_FALSE(output_surface_->InitializeAndSetContext3d(
6661 output_surface_->InitializeAndSetContext3d(onscreen_context_provider_)); 6661 onscreen_context_provider_, nullptr));
6662 EXPECT_FALSE(host_impl_->output_surface()->context_provider()); 6662 EXPECT_FALSE(host_impl_->output_surface()->context_provider());
6663 EXPECT_FALSE(did_update_renderer_capabilities_); 6663 EXPECT_FALSE(did_update_renderer_capabilities_);
6664 6664
6665 // Software draw again. 6665 // Software draw again.
6666 DrawFrame(); 6666 DrawFrame();
6667 } 6667 }
6668 6668
6669 // Checks that we have a non-0 default allocation if we pass a context that 6669 // Checks that we have a non-0 default allocation if we pass a context that
6670 // doesn't support memory management extensions. 6670 // doesn't support memory management extensions.
6671 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { 6671 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
8215 // surface. 8215 // surface.
8216 EXPECT_EQ(0, num_lost_surfaces_); 8216 EXPECT_EQ(0, num_lost_surfaces_);
8217 host_impl_->DidLoseOutputSurface(); 8217 host_impl_->DidLoseOutputSurface();
8218 EXPECT_EQ(1, num_lost_surfaces_); 8218 EXPECT_EQ(1, num_lost_surfaces_);
8219 host_impl_->DidLoseOutputSurface(); 8219 host_impl_->DidLoseOutputSurface();
8220 EXPECT_LE(1, num_lost_surfaces_); 8220 EXPECT_LE(1, num_lost_surfaces_);
8221 } 8221 }
8222 8222
8223 } // namespace 8223 } // namespace
8224 } // namespace cc 8224 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698