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

Side by Side Diff: cc/layer_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply Dana's code review suggestions Created 8 years, 2 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer.h" 7 #include "cc/layer.h"
8 8
9 #include "cc/keyframed_animation_curve.h" 9 #include "cc/keyframed_animation_curve.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 23 matching lines...) Expand all
34 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); \ 34 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); \
35 } while (0) 35 } while (0)
36 36
37 namespace { 37 namespace {
38 38
39 class MockLayerImplTreeHost : public LayerTreeHost { 39 class MockLayerImplTreeHost : public LayerTreeHost {
40 public: 40 public:
41 MockLayerImplTreeHost() 41 MockLayerImplTreeHost()
42 : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) 42 : LayerTreeHost(&m_fakeClient, LayerTreeSettings())
43 { 43 {
44 initialize(); 44 initialize(0);
45 } 45 }
46 46
47 MOCK_METHOD0(setNeedsCommit, void()); 47 MOCK_METHOD0(setNeedsCommit, void());
48 48
49 private: 49 private:
50 FakeLayerImplTreeHostClient m_fakeClient; 50 FakeLayerImplTreeHostClient m_fakeClient;
51 }; 51 };
52 52
53 class MockLayerPainter : public LayerPainter { 53 class MockLayerPainter : public LayerPainter {
54 public: 54 public:
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // The above tests should not have caused a change to the needsDisplay flag. 513 // The above tests should not have caused a change to the needsDisplay flag.
514 EXPECT_FALSE(testLayer->needsDisplay()); 514 EXPECT_FALSE(testLayer->needsDisplay());
515 515
516 // Test properties that should call setNeedsDisplay and setNeedsCommit 516 // Test properties that should call setNeedsDisplay and setNeedsCommit
517 EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(IntSize (5, 10))); 517 EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(IntSize (5, 10)));
518 EXPECT_TRUE(testLayer->needsDisplay()); 518 EXPECT_TRUE(testLayer->needsDisplay());
519 } 519 }
520 520
521 TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) 521 TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect)
522 { 522 {
523 DebugScopedSetImplThread setImplThread;
524
525 scoped_refptr<Layer> testLayer = Layer::create(); 523 scoped_refptr<Layer> testLayer = Layer::create();
526 scoped_ptr<LayerImpl> implLayer = LayerImpl::create(1); 524 scoped_ptr<LayerImpl> implLayer = LayerImpl::create(1);
527 525
528 testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5) )); 526 testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5) ));
529 testLayer->pushPropertiesTo(implLayer.get()); 527 testLayer->pushPropertiesTo(implLayer.get());
530 EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLay er->updateRect()); 528 EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLay er->updateRect());
531 529
532 // The LayerImpl's updateRect should be accumulated here, since we did not d o anything to clear it. 530 // The LayerImpl's updateRect should be accumulated here, since we did not d o anything to clear it.
533 testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5) )); 531 testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5) ));
534 testLayer->pushPropertiesTo(implLayer.get()); 532 testLayer->pushPropertiesTo(implLayer.get());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 EXPECT_TRUE(testLayer->needsDisplay()); 587 EXPECT_TRUE(testLayer->needsDisplay());
590 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240), testLayer->lastNeedsDisplayR ect()); 588 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240), testLayer->lastNeedsDisplayR ect());
591 } 589 }
592 590
593 class FakeLayerImplTreeHost : public LayerTreeHost { 591 class FakeLayerImplTreeHost : public LayerTreeHost {
594 public: 592 public:
595 static scoped_ptr<FakeLayerImplTreeHost> create() 593 static scoped_ptr<FakeLayerImplTreeHost> create()
596 { 594 {
597 scoped_ptr<FakeLayerImplTreeHost> host(new FakeLayerImplTreeHost); 595 scoped_ptr<FakeLayerImplTreeHost> host(new FakeLayerImplTreeHost);
598 // The initialize call will fail, since our client doesn't provide a val id GraphicsContext3D, but it doesn't matter in the tests that use this fake so i gnore the return value. 596 // The initialize call will fail, since our client doesn't provide a val id GraphicsContext3D, but it doesn't matter in the tests that use this fake so i gnore the return value.
599 host->initialize(); 597 host->initialize(0);
600 return host.Pass(); 598 return host.Pass();
601 } 599 }
602 600
603 private: 601 private:
604 FakeLayerImplTreeHost() 602 FakeLayerImplTreeHost()
605 : LayerTreeHost(&m_client, LayerTreeSettings()) 603 : LayerTreeHost(&m_client, LayerTreeSettings())
606 { 604 {
607 } 605 }
608 606
609 FakeLayerImplTreeHostClient m_client; 607 FakeLayerImplTreeHostClient m_client;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 scoped_refptr<MockLayer> layer(new MockLayer); 839 scoped_refptr<MockLayer> layer(new MockLayer);
842 EXPECT_FALSE(layer->needsDisplay()); 840 EXPECT_FALSE(layer->needsDisplay());
843 layer->setBounds(IntSize(0, 10)); 841 layer->setBounds(IntSize(0, 10));
844 EXPECT_FALSE(layer->needsDisplay()); 842 EXPECT_FALSE(layer->needsDisplay());
845 layer->setBounds(IntSize(10, 10)); 843 layer->setBounds(IntSize(10, 10));
846 EXPECT_TRUE(layer->needsDisplay()); 844 EXPECT_TRUE(layer->needsDisplay());
847 } 845 }
848 846
849 847
850 } // namespace 848 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698