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

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

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/output/copy_output_request.h" 5 #include "cc/output/copy_output_request.h"
6 #include "cc/output/copy_output_result.h" 6 #include "cc/output/copy_output_result.h"
7 #include "cc/test/fake_content_layer.h" 7 #include "cc/test/fake_content_layer.h"
8 #include "cc/test/fake_content_layer_client.h" 8 #include "cc/test/fake_content_layer_client.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread()); 96 EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
97 EXPECT_TRUE(result->HasBitmap()); 97 EXPECT_TRUE(result->HasBitmap());
98 scoped_ptr<SkBitmap> bitmap = result->TakeBitmap().Pass(); 98 scoped_ptr<SkBitmap> bitmap = result->TakeBitmap().Pass();
99 EXPECT_EQ(result->size().ToString(), 99 EXPECT_EQ(result->size().ToString(),
100 gfx::Size(bitmap->width(), bitmap->height()).ToString()); 100 gfx::Size(bitmap->width(), bitmap->height()).ToString());
101 callbacks_.push_back(result->size()); 101 callbacks_.push_back(result->size());
102 } 102 }
103 103
104 void AfterTest() override { EXPECT_EQ(4u, callbacks_.size()); } 104 void AfterTest() override { EXPECT_EQ(4u, callbacks_.size()); }
105 105
106 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( 106 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
107 bool fallback) override {
108 if (use_gl_renderer_) 107 if (use_gl_renderer_)
109 return FakeOutputSurface::Create3d(); 108 return FakeOutputSurface::Create3d();
110 return FakeOutputSurface::CreateSoftware( 109 return FakeOutputSurface::CreateSoftware(
111 make_scoped_ptr(new SoftwareOutputDevice)); 110 make_scoped_ptr(new SoftwareOutputDevice));
112 } 111 }
113 112
114 bool use_gl_renderer_; 113 bool use_gl_renderer_;
115 std::vector<gfx::Size> callbacks_; 114 std::vector<gfx::Size> callbacks_;
116 FakeContentLayerClient client_; 115 FakeContentLayerClient client_;
117 scoped_refptr<FakeContentLayer> root; 116 scoped_refptr<FakeContentLayer> root;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 scoped_refptr<FakeContentLayer> root_; 526 scoped_refptr<FakeContentLayer> root_;
528 scoped_refptr<FakeContentLayer> copy_layer_; 527 scoped_refptr<FakeContentLayer> copy_layer_;
529 }; 528 };
530 529
531 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( 530 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
532 LayerTreeHostTestAsyncTwoReadbacksWithoutDraw); 531 LayerTreeHostTestAsyncTwoReadbacksWithoutDraw);
533 532
534 class LayerTreeHostCopyRequestTestLostOutputSurface 533 class LayerTreeHostCopyRequestTestLostOutputSurface
535 : public LayerTreeHostCopyRequestTest { 534 : public LayerTreeHostCopyRequestTest {
536 protected: 535 protected:
537 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( 536 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
538 bool fallback) override {
539 if (!first_context_provider_.get()) { 537 if (!first_context_provider_.get()) {
540 first_context_provider_ = TestContextProvider::Create(); 538 first_context_provider_ = TestContextProvider::Create();
541 return FakeOutputSurface::Create3d(first_context_provider_); 539 return FakeOutputSurface::Create3d(first_context_provider_);
542 } 540 }
543 541
544 EXPECT_FALSE(second_context_provider_.get()); 542 EXPECT_FALSE(second_context_provider_.get());
545 second_context_provider_ = TestContextProvider::Create(); 543 second_context_provider_ = TestContextProvider::Create();
546 return FakeOutputSurface::Create3d(second_context_provider_); 544 return FakeOutputSurface::Create3d(second_context_provider_);
547 } 545 }
548 546
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 scoped_refptr<FakeContentLayer> copy_layer_; 654 scoped_refptr<FakeContentLayer> copy_layer_;
657 scoped_ptr<CopyOutputResult> result_; 655 scoped_ptr<CopyOutputResult> result_;
658 }; 656 };
659 657
660 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( 658 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
661 LayerTreeHostCopyRequestTestLostOutputSurface); 659 LayerTreeHostCopyRequestTestLostOutputSurface);
662 660
663 class LayerTreeHostCopyRequestTestCountTextures 661 class LayerTreeHostCopyRequestTestCountTextures
664 : public LayerTreeHostCopyRequestTest { 662 : public LayerTreeHostCopyRequestTest {
665 protected: 663 protected:
666 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( 664 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
667 bool fallback) override {
668 context_provider_ = TestContextProvider::Create(); 665 context_provider_ = TestContextProvider::Create();
669 return FakeOutputSurface::Create3d(context_provider_); 666 return FakeOutputSurface::Create3d(context_provider_);
670 } 667 }
671 668
672 void SetupTree() override { 669 void SetupTree() override {
673 root_ = FakeContentLayer::Create(&client_); 670 root_ = FakeContentLayer::Create(&client_);
674 root_->SetBounds(gfx::Size(20, 20)); 671 root_->SetBounds(gfx::Size(20, 20));
675 672
676 copy_layer_ = FakeContentLayer::Create(&client_); 673 copy_layer_ = FakeContentLayer::Create(&client_);
677 copy_layer_->SetBounds(gfx::Size(10, 10)); 674 copy_layer_->SetBounds(gfx::Size(10, 10));
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 FakeContentLayerClient client_; 960 FakeContentLayerClient client_;
964 scoped_refptr<FakeContentLayer> root_; 961 scoped_refptr<FakeContentLayer> root_;
965 scoped_refptr<FakeContentLayer> copy_layer_; 962 scoped_refptr<FakeContentLayer> copy_layer_;
966 }; 963 };
967 964
968 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 965 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
969 LayerTreeHostCopyRequestTestShutdownBeforeCopy); 966 LayerTreeHostCopyRequestTestShutdownBeforeCopy);
970 967
971 } // namespace 968 } // namespace
972 } // namespace cc 969 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_no_message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698