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

Side by Side Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: rebase Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "cc/output/compositor_frame.h" 14 #include "cc/output/compositor_frame.h"
15 #include "cc/output/delegated_frame_data.h" 15 #include "cc/output/delegated_frame_data.h"
16 #include "cc/quads/render_pass.h" 16 #include "cc/quads/render_pass.h"
17 #include "cc/quads/render_pass_draw_quad.h" 17 #include "cc/quads/render_pass_draw_quad.h"
18 #include "cc/quads/solid_color_draw_quad.h" 18 #include "cc/quads/solid_color_draw_quad.h"
19 #include "cc/quads/surface_draw_quad.h" 19 #include "cc/quads/surface_draw_quad.h"
20 #include "cc/quads/texture_draw_quad.h" 20 #include "cc/quads/texture_draw_quad.h"
21 #include "cc/resources/shared_bitmap_manager.h" 21 #include "cc/resources/shared_bitmap_manager.h"
22 #include "cc/surfaces/surface.h" 22 #include "cc/surfaces/surface.h"
23 #include "cc/surfaces/surface_factory.h" 23 #include "cc/surfaces/surface_factory.h"
24 #include "cc/surfaces/surface_factory_client.h" 24 #include "cc/surfaces/surface_factory_client.h"
25 #include "cc/surfaces/surface_id_allocator.h" 25 #include "cc/surfaces/surface_id_allocator.h"
26 #include "cc/surfaces/surface_manager.h" 26 #include "cc/surfaces/surface_manager.h"
27 #include "cc/test/fake_output_surface.h"
28 #include "cc/test/fake_output_surface_client.h"
29 #include "cc/test/fake_resource_provider.h" 27 #include "cc/test/fake_resource_provider.h"
30 #include "cc/test/render_pass_test_utils.h" 28 #include "cc/test/render_pass_test_utils.h"
31 #include "cc/test/surface_aggregator_test_helpers.h" 29 #include "cc/test/surface_aggregator_test_helpers.h"
32 #include "cc/test/test_shared_bitmap_manager.h" 30 #include "cc/test/test_shared_bitmap_manager.h"
33 #include "testing/gmock/include/gmock/gmock.h" 31 #include "testing/gmock/include/gmock/gmock.h"
34 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
35 #include "third_party/skia/include/core/SkColor.h" 33 #include "third_party/skia/include/core/SkColor.h"
36 34
37 namespace cc { 35 namespace cc {
38 namespace { 36 namespace {
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[2]->damage_rect); 1816 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[2]->damage_rect);
1819 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size()); 1817 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1820 } 1818 }
1821 1819
1822 factory_.Destroy(child_surface_id); 1820 factory_.Destroy(child_surface_id);
1823 } 1821 }
1824 1822
1825 class SurfaceAggregatorWithResourcesTest : public testing::Test { 1823 class SurfaceAggregatorWithResourcesTest : public testing::Test {
1826 public: 1824 public:
1827 void SetUp() override { 1825 void SetUp() override {
1828 output_surface_ = FakeOutputSurface::CreateSoftware(
1829 base::WrapUnique(new SoftwareOutputDevice));
1830 output_surface_->BindToClient(&output_surface_client_);
1831 shared_bitmap_manager_.reset(new TestSharedBitmapManager); 1826 shared_bitmap_manager_.reset(new TestSharedBitmapManager);
1832 1827 resource_provider_ =
1833 resource_provider_ = FakeResourceProvider::Create( 1828 FakeResourceProvider::Create(nullptr, shared_bitmap_manager_.get());
1834 output_surface_.get(), shared_bitmap_manager_.get());
1835 1829
1836 aggregator_.reset( 1830 aggregator_.reset(
1837 new SurfaceAggregator(&manager_, resource_provider_.get(), false)); 1831 new SurfaceAggregator(&manager_, resource_provider_.get(), false));
1838 aggregator_->set_output_is_secure(true); 1832 aggregator_->set_output_is_secure(true);
1839 } 1833 }
1840 1834
1841 protected: 1835 protected:
1842 SurfaceManager manager_; 1836 SurfaceManager manager_;
1843 FakeOutputSurfaceClient output_surface_client_;
1844 std::unique_ptr<OutputSurface> output_surface_;
1845 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; 1837 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_;
1846 std::unique_ptr<ResourceProvider> resource_provider_; 1838 std::unique_ptr<ResourceProvider> resource_provider_;
1847 std::unique_ptr<SurfaceAggregator> aggregator_; 1839 std::unique_ptr<SurfaceAggregator> aggregator_;
1848 }; 1840 };
1849 1841
1850 class ResourceTrackingSurfaceFactoryClient : public SurfaceFactoryClient { 1842 class ResourceTrackingSurfaceFactoryClient : public SurfaceFactoryClient {
1851 public: 1843 public:
1852 ResourceTrackingSurfaceFactoryClient() {} 1844 ResourceTrackingSurfaceFactoryClient() {}
1853 ~ResourceTrackingSurfaceFactoryClient() override {} 1845 ~ResourceTrackingSurfaceFactoryClient() override {}
1854 1846
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 // Output is insecure, so texture should be drawn. 2124 // Output is insecure, so texture should be drawn.
2133 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); 2125 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material);
2134 2126
2135 factory.Destroy(surface1_id); 2127 factory.Destroy(surface1_id);
2136 factory.Destroy(surface2_id); 2128 factory.Destroy(surface2_id);
2137 } 2129 }
2138 2130
2139 } // namespace 2131 } // namespace
2140 } // namespace cc 2132 } // namespace cc
2141 2133
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698