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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 84210e0bc2f3ab93759f210218af07e52e5c2bdd..69e5272f55e451971198584ee80aa4b9b97774cb 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -5737,6 +5737,48 @@ class LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy
MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy);
+class RasterizeWithGpuRasterizationCreatesResources : public LayerTreeHostTest {
+ protected:
+ RasterizeWithGpuRasterizationCreatesResources() {}
+
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->impl_side_painting = true;
+ settings->gpu_rasterization_forced = true;
+ }
+
+ void SetupTree() override {
+ client_.set_fill_with_nonsolid_color(true);
+
+ scoped_refptr<Layer> root = Layer::Create();
+ root->SetBounds(gfx::Size(500, 500));
+
+ scoped_ptr<FakePicturePile> pile(new FakePicturePile);
+ scoped_refptr<FakePictureLayer> layer =
+ FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass());
+ layer->SetBounds(gfx::Size(500, 500));
+ layer->SetContentsOpaque(true);
+ root->AddChild(layer);
+
+ layer_tree_host()->SetRootLayer(root);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawResult draw_result) override {
+ EXPECT_NE(0u, host_impl->resource_provider()->num_resources());
+ EndTest();
+ return draw_result;
+ }
+ void AfterTest() override {}
+
+ FakeContentLayerClient client_;
+};
+
+MULTI_THREAD_IMPL_TEST_F(RasterizeWithGpuRasterizationCreatesResources);
+
class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles
: public LayerTreeHostTest {
protected:
@@ -5970,6 +6012,50 @@ class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest {
MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles);
+class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest {
+ public:
+ LayerTreeHostTestActivationCausesPrepareTiles()
+ : scheduled_prepare_tiles_count_(0) {}
+
+ void SetupTree() override {
+ client_.set_fill_with_nonsolid_color(true);
+ scoped_refptr<FakePictureLayer> root_layer =
+ FakePictureLayer::Create(&client_);
+ root_layer->SetBounds(gfx::Size(150, 150));
+ root_layer->SetIsDrawable(true);
+
+ layer_tree_host()->SetRootLayer(root_layer);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
+ // Ensure we've already activated.
+ EXPECT_FALSE(impl->pending_tree());
+
+ // After activating, we either need to prepare tiles, or we've already
+ // called a scheduled prepare tiles. This is done because activation might
+ // cause us to have to memory available (old active tree is gone), so we
+ // need to ensure we will get a PrepareTiles call.
+ if (!impl->prepare_tiles_needed())
+ EXPECT_GE(scheduled_prepare_tiles_count_, 1);
+ EndTest();
+ }
+
+ void ScheduledActionPrepareTiles() override {
+ ++scheduled_prepare_tiles_count_;
+ }
+
+ void AfterTest() override {}
+
+ protected:
+ FakeContentLayerClient client_;
+ int scheduled_prepare_tiles_count_;
+};
+
+MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestActivationCausesPrepareTiles);
+
// This tests an assertion that DidCommit and WillCommit happen in the same
// stack frame with no tasks that run between them. Various embedders of
// cc depend on this logic. ui::Compositor holds a compositor lock between
« no previous file with comments | « cc/trees/layer_tree_host_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698