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

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

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 TEST(LayerTreeHostTest, LimitPartialUpdates) { 2092 TEST(LayerTreeHostTest, LimitPartialUpdates) {
2093 // When partial updates are not allowed, max updates should be 0. 2093 // When partial updates are not allowed, max updates should be 0.
2094 { 2094 {
2095 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 2095 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
2096 2096
2097 scoped_ptr<FakeProxy> proxy(new FakeProxy); 2097 scoped_ptr<FakeProxy> proxy(new FakeProxy);
2098 proxy->GetRendererCapabilities().allow_partial_texture_updates = false; 2098 proxy->GetRendererCapabilities().allow_partial_texture_updates = false;
2099 proxy->SetMaxPartialTextureUpdates(5); 2099 proxy->SetMaxPartialTextureUpdates(5);
2100 2100
2101 LayerTreeSettings settings; 2101 LayerTreeSettings settings;
2102 settings.impl_side_painting = false;
2102 settings.max_partial_texture_updates = 10; 2103 settings.max_partial_texture_updates = 10;
2103 2104
2104 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); 2105 LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
2105 2106
2106 EXPECT_EQ(0u, host.MaxPartialTextureUpdates()); 2107 EXPECT_EQ(0u, host.MaxPartialTextureUpdates());
2107 } 2108 }
2108 2109
2109 // When partial updates are allowed, 2110 // When partial updates are allowed,
2110 // max updates should be limited by the proxy. 2111 // max updates should be limited by the proxy.
2111 { 2112 {
2112 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 2113 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
2113 2114
2114 scoped_ptr<FakeProxy> proxy(new FakeProxy); 2115 scoped_ptr<FakeProxy> proxy(new FakeProxy);
2115 proxy->GetRendererCapabilities().allow_partial_texture_updates = true; 2116 proxy->GetRendererCapabilities().allow_partial_texture_updates = true;
2116 proxy->SetMaxPartialTextureUpdates(5); 2117 proxy->SetMaxPartialTextureUpdates(5);
2117 2118
2118 LayerTreeSettings settings; 2119 LayerTreeSettings settings;
2120 settings.impl_side_painting = false;
2119 settings.max_partial_texture_updates = 10; 2121 settings.max_partial_texture_updates = 10;
2120 2122
2121 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); 2123 LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
2122 2124
2123 EXPECT_EQ(5u, host.MaxPartialTextureUpdates()); 2125 EXPECT_EQ(5u, host.MaxPartialTextureUpdates());
2124 } 2126 }
2125 2127
2126 // When partial updates are allowed, 2128 // When partial updates are allowed,
2127 // max updates should also be limited by the settings. 2129 // max updates should also be limited by the settings.
2128 { 2130 {
2129 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 2131 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
2130 2132
2131 scoped_ptr<FakeProxy> proxy(new FakeProxy); 2133 scoped_ptr<FakeProxy> proxy(new FakeProxy);
2132 proxy->GetRendererCapabilities().allow_partial_texture_updates = true; 2134 proxy->GetRendererCapabilities().allow_partial_texture_updates = true;
2133 proxy->SetMaxPartialTextureUpdates(20); 2135 proxy->SetMaxPartialTextureUpdates(20);
2134 2136
2135 LayerTreeSettings settings; 2137 LayerTreeSettings settings;
2138 settings.impl_side_painting = false;
2136 settings.max_partial_texture_updates = 10; 2139 settings.max_partial_texture_updates = 10;
2137 2140
2138 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); 2141 LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
2139 2142
2140 EXPECT_EQ(10u, host.MaxPartialTextureUpdates()); 2143 EXPECT_EQ(10u, host.MaxPartialTextureUpdates());
2141 } 2144 }
2142 } 2145 }
2143 2146
2144 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { 2147 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) {
2145 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 2148 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
2146 2149
2147 LayerTreeSettings settings; 2150 LayerTreeSettings settings;
2148 settings.max_partial_texture_updates = 4; 2151 settings.max_partial_texture_updates = 4;
2149 settings.single_thread_proxy_scheduler = false; 2152 settings.single_thread_proxy_scheduler = false;
2153 settings.impl_side_painting = false;
2150 2154
2151 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2155 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2152 new TestSharedBitmapManager()); 2156 new TestSharedBitmapManager());
2153 scoped_ptr<LayerTreeHost> host = 2157 scoped_ptr<LayerTreeHost> host =
2154 LayerTreeHost::CreateSingleThreaded(&client, 2158 LayerTreeHost::CreateSingleThreaded(&client,
2155 &client, 2159 &client,
2156 shared_bitmap_manager.get(), 2160 shared_bitmap_manager.get(),
2157 NULL, 2161 NULL,
2158 settings, 2162 settings,
2159 base::MessageLoopProxy::current(), 2163 base::MessageLoopProxy::current(),
2160 nullptr); 2164 nullptr);
2161 client.SetLayerTreeHost(host.get()); 2165 client.SetLayerTreeHost(host.get());
2162 host->Composite(base::TimeTicks::Now()); 2166 host->Composite(base::TimeTicks::Now());
2163 2167
2164 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2168 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2165 } 2169 }
2166 2170
2167 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { 2171 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
2168 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); 2172 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE);
2169 2173
2170 LayerTreeSettings settings; 2174 LayerTreeSettings settings;
2171 settings.max_partial_texture_updates = 4; 2175 settings.max_partial_texture_updates = 4;
2172 settings.single_thread_proxy_scheduler = false; 2176 settings.single_thread_proxy_scheduler = false;
2177 settings.impl_side_painting = false;
2173 2178
2174 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2179 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2175 new TestSharedBitmapManager()); 2180 new TestSharedBitmapManager());
2176 scoped_ptr<LayerTreeHost> host = 2181 scoped_ptr<LayerTreeHost> host =
2177 LayerTreeHost::CreateSingleThreaded(&client, 2182 LayerTreeHost::CreateSingleThreaded(&client,
2178 &client, 2183 &client,
2179 shared_bitmap_manager.get(), 2184 shared_bitmap_manager.get(),
2180 NULL, 2185 NULL,
2181 settings, 2186 settings,
2182 base::MessageLoopProxy::current(), 2187 base::MessageLoopProxy::current(),
2183 nullptr); 2188 nullptr);
2184 client.SetLayerTreeHost(host.get()); 2189 client.SetLayerTreeHost(host.get());
2185 host->Composite(base::TimeTicks::Now()); 2190 host->Composite(base::TimeTicks::Now());
2186 2191
2187 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2192 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2188 } 2193 }
2189 2194
2190 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { 2195 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
2191 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); 2196 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D);
2192 2197
2193 LayerTreeSettings settings; 2198 LayerTreeSettings settings;
2194 settings.max_partial_texture_updates = 4; 2199 settings.max_partial_texture_updates = 4;
2195 settings.single_thread_proxy_scheduler = false; 2200 settings.single_thread_proxy_scheduler = false;
2201 settings.impl_side_painting = false;
2196 2202
2197 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2203 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2198 new TestSharedBitmapManager()); 2204 new TestSharedBitmapManager());
2199 scoped_ptr<LayerTreeHost> host = 2205 scoped_ptr<LayerTreeHost> host =
2200 LayerTreeHost::CreateSingleThreaded(&client, 2206 LayerTreeHost::CreateSingleThreaded(&client,
2201 &client, 2207 &client,
2202 shared_bitmap_manager.get(), 2208 shared_bitmap_manager.get(),
2203 NULL, 2209 NULL,
2204 settings, 2210 settings,
2205 base::MessageLoopProxy::current(), 2211 base::MessageLoopProxy::current(),
2206 nullptr); 2212 nullptr);
2207 client.SetLayerTreeHost(host.get()); 2213 client.SetLayerTreeHost(host.get());
2208 host->Composite(base::TimeTicks::Now()); 2214 host->Composite(base::TimeTicks::Now());
2209 2215
2210 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2216 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2211 } 2217 }
2212 2218
2213 TEST(LayerTreeHostTest, 2219 TEST(LayerTreeHostTest,
2214 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { 2220 PartialUpdatesWithDelegatingRendererAndSoftwareContent) {
2215 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); 2221 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE);
2216 2222
2217 LayerTreeSettings settings; 2223 LayerTreeSettings settings;
2218 settings.max_partial_texture_updates = 4; 2224 settings.max_partial_texture_updates = 4;
2219 settings.single_thread_proxy_scheduler = false; 2225 settings.single_thread_proxy_scheduler = false;
2226 settings.impl_side_painting = false;
2220 2227
2221 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2228 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2222 new TestSharedBitmapManager()); 2229 new TestSharedBitmapManager());
2223 scoped_ptr<LayerTreeHost> host = 2230 scoped_ptr<LayerTreeHost> host =
2224 LayerTreeHost::CreateSingleThreaded(&client, 2231 LayerTreeHost::CreateSingleThreaded(&client,
2225 &client, 2232 &client,
2226 shared_bitmap_manager.get(), 2233 shared_bitmap_manager.get(),
2227 NULL, 2234 NULL,
2228 settings, 2235 settings,
2229 base::MessageLoopProxy::current(), 2236 base::MessageLoopProxy::current(),
(...skipping 4100 matching lines...) Expand 10 before | Expand all | Expand 10 after
6330 6337
6331 void AfterTest() override {} 6338 void AfterTest() override {}
6332 6339
6333 private: 6340 private:
6334 scoped_refptr<Layer> child_; 6341 scoped_refptr<Layer> child_;
6335 }; 6342 };
6336 6343
6337 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); 6344 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests);
6338 6345
6339 } // namespace cc 6346 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_masks.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698