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

Side by Side Diff: cc/layer_tree_host_unittest.cc

Issue 11618032: Merge 174073 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer.cc ('k') | cc/tiled_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "cc/content_layer.h" 8 #include "cc/content_layer.h"
9 #include "cc/content_layer_client.h" 9 #include "cc/content_layer_client.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 private: 271 private:
272 int m_numCommits; 272 int m_numCommits;
273 int m_numDraws; 273 int m_numDraws;
274 }; 274 };
275 275
276 TEST_F(LayerTreeHostTestSetNeedsRedraw, runMultiThread) 276 TEST_F(LayerTreeHostTestSetNeedsRedraw, runMultiThread)
277 { 277 {
278 runTest(true); 278 runTest(true);
279 } 279 }
280 280
281 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
282 public:
283 LayerTreeHostTestNoExtraCommitFromInvalidate()
284 : m_rootLayer(ContentLayer::create(&m_client))
285 {
286 }
287
288 virtual void beginTest() OVERRIDE
289 {
290 m_rootLayer->setAutomaticallyComputeRasterScale(false);
291 m_rootLayer->setIsDrawable(true);
292 m_rootLayer->setBounds(gfx::Size(1, 1));
293 m_layerTreeHost->setRootLayer(m_rootLayer);
294 postSetNeedsCommitToMainThread();
295 }
296
297 virtual void didCommit() OVERRIDE
298 {
299 switch (m_layerTreeHost->commitNumber()) {
300 case 1:
301 // Changing the content bounds will cause a single commit!
302 m_rootLayer->setRasterScale(4.0f);
303 break;
304 default:
305 // No extra commits.
306 EXPECT_EQ(2, m_layerTreeHost->commitNumber());
307 endTest();
308 }
309 }
310
311 virtual void afterTest() OVERRIDE
312 {
313 }
314
315 private:
316 FakeContentLayerClient m_client;
317 scoped_refptr<ContentLayer> m_rootLayer;
318 };
319
320 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate)
281 // If the layerTreeHost says it can't draw, then we should not try to draw. 321 // If the layerTreeHost says it can't draw, then we should not try to draw.
282 class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest { 322 class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest {
283 public: 323 public:
284 LayerTreeHostTestCanDrawBlocksDrawing() 324 LayerTreeHostTestCanDrawBlocksDrawing()
285 : m_numCommits(0) 325 : m_numCommits(0)
286 , m_done(false) 326 , m_done(false)
287 { 327 {
288 } 328 }
289 329
290 virtual void beginTest() OVERRIDE 330 virtual void beginTest() OVERRIDE
(...skipping 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3413 LayerTreeSettings settings; 3453 LayerTreeSettings settings;
3414 settings.maxPartialTextureUpdates = 4; 3454 settings.maxPartialTextureUpdates = 4;
3415 3455
3416 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 3456 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3417 EXPECT_TRUE(host->initializeRendererIfNeeded()); 3457 EXPECT_TRUE(host->initializeRendererIfNeeded());
3418 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); 3458 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
3419 } 3459 }
3420 3460
3421 } // namespace 3461 } // namespace
3422 } // namespace cc 3462 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer.cc ('k') | cc/tiled_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698