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

Side by Side Diff: webkit/compositor_bindings/TextureLayerChromiumTest.cpp

Issue 10917153: Update cc snapshot to r127918 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "TextureLayerChromium.h" 7 #include "TextureLayerChromium.h"
8 8
9 #include "CCLayerTreeHost.h" 9 #include "CCLayerTreeHost.h"
10 #include "FakeCCLayerTreeHostClient.h" 10 #include "FakeCCLayerTreeHostClient.h"
11 #include "WebCompositorInitializer.h"
11 #include <gmock/gmock.h> 12 #include <gmock/gmock.h>
12 #include <gtest/gtest.h> 13 #include <gtest/gtest.h>
13 #include <public/WebCompositor.h>
14 14
15 using namespace WebCore; 15 using namespace WebCore;
16 using ::testing::Mock; 16 using ::testing::Mock;
17 using ::testing::_; 17 using ::testing::_;
18 using ::testing::AtLeast; 18 using ::testing::AtLeast;
19 using ::testing::AnyNumber; 19 using ::testing::AnyNumber;
20 20
21 namespace { 21 namespace {
22 22
23 class MockCCLayerTreeHost : public CCLayerTreeHost { 23 class MockCCLayerTreeHost : public CCLayerTreeHost {
24 public: 24 public:
25 MockCCLayerTreeHost() 25 MockCCLayerTreeHost()
26 : CCLayerTreeHost(&m_fakeClient, CCLayerTreeSettings()) 26 : CCLayerTreeHost(&m_fakeClient, CCLayerTreeSettings())
27 { 27 {
28 initialize(); 28 initialize();
29 } 29 }
30 30
31 MOCK_METHOD0(acquireLayerTextures, void()); 31 MOCK_METHOD0(acquireLayerTextures, void());
32 32
33 private: 33 private:
34 FakeCCLayerTreeHostClient m_fakeClient; 34 FakeCCLayerTreeHostClient m_fakeClient;
35 }; 35 };
36 36
37 37
38 class TextureLayerChromiumTest : public testing::Test { 38 class TextureLayerChromiumTest : public testing::Test {
39 public:
40 TextureLayerChromiumTest()
41 : m_compositorInitializer(0)
42 {
43 }
44
39 protected: 45 protected:
40 virtual void SetUp() 46 virtual void SetUp()
41 { 47 {
42 // Initialize without threading support.
43 WebKit::WebCompositor::initialize(0);
44 m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); 48 m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
45 } 49 }
46 50
47 virtual void TearDown() 51 virtual void TearDown()
48 { 52 {
49 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); 53 Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
50 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()) ; 54 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()) ;
51 55
52 m_layerTreeHost->setRootLayer(0); 56 m_layerTreeHost->setRootLayer(0);
53 m_layerTreeHost.clear(); 57 m_layerTreeHost.clear();
54 WebKit::WebCompositor::shutdown();
55 } 58 }
56 59
57 OwnPtr<MockCCLayerTreeHost> m_layerTreeHost; 60 OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
61 private:
62 WebKitTests::WebCompositorInitializer m_compositorInitializer;
58 }; 63 };
59 64
60 TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId) 65 TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId)
61 { 66 {
62 RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); 67 RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0);
63 ASSERT_TRUE(testLayer); 68 ASSERT_TRUE(testLayer);
64 69
65 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); 70 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber());
66 m_layerTreeHost->setRootLayer(testLayer); 71 m_layerTreeHost->setRootLayer(testLayer);
67 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); 72 Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); 112 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0);
108 testLayer->setTextureId(1); 113 testLayer->setTextureId(1);
109 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); 114 Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
110 115
111 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); 116 EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1));
112 testLayer->removeFromParent(); 117 testLayer->removeFromParent();
113 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); 118 Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
114 } 119 }
115 120
116 } // anonymous namespace 121 } // anonymous namespace
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/PlatformGestureCurveTarget.h ('k') | webkit/compositor_bindings/TiledLayerChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698