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

Side by Side Diff: cc/texture_copier_unittest.cc

Issue 11150025: Patch from https://codereview.chromium.org/11111005/ without actual file deletes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « cc/texture_copier.cc ('k') | cc/texture_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 "config.h" 5 #include "config.h"
6 6
7 #include "TextureCopier.h" 7 #include "TextureCopier.h"
8 8
9 #include "FakeWebGraphicsContext3D.h"
10 #include "GraphicsContext3D.h"
11 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/khronos/GLES2/gl2.h"
12 #include "FakeWebGraphicsContext3D.h"
13 #include <wtf/RefPtr.h> 13 #include <wtf/RefPtr.h>
14 14
15 using namespace cc; 15 using namespace cc;
16 using namespace WebKit; 16 using namespace WebKit;
17 using testing::InSequence; 17 using testing::InSequence;
18 using testing::Test; 18 using testing::Test;
19 using testing::_; 19 using testing::_;
20 20
21 class MockContext : public FakeWebGraphicsContext3D { 21 class MockContext : public FakeWebGraphicsContext3D {
22 public: 22 public:
23 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId)); 23 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId));
24 MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint param)); 24 MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint param));
25 25
26 MOCK_METHOD3(drawArrays, void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei cou nt)); 26 MOCK_METHOD3(drawArrays, void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei cou nt));
27 }; 27 };
28 28
29 TEST(TextureCopierTest, testDrawArraysCopy) 29 TEST(TextureCopierTest, testDrawArraysCopy)
30 { 30 {
31 OwnPtr<MockContext> mockContext = adoptPtr(new MockContext); 31 OwnPtr<MockContext> mockContext = adoptPtr(new MockContext);
32 32
33 { 33 {
34 InSequence sequence; 34 InSequence sequence;
35 35
36 // Here we check just some essential properties of copyTexture() to avoi d mirroring the full implementation. 36 // Here we check just some essential properties of copyTexture() to avoi d mirroring the full implementation.
37 EXPECT_CALL(*mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER , _)); 37 EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, _));
38 38
39 // Make sure linear filtering is disabled during the copy. 39 // Make sure linear filtering is disabled during the copy.
40 EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, G raphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); 40 EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FI LTER, GL_NEAREST));
41 EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, G raphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); 41 EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FI LTER, GL_NEAREST));
42 42
43 EXPECT_CALL(*mockContext, drawArrays(_, _, _)); 43 EXPECT_CALL(*mockContext, drawArrays(_, _, _));
44 44
45 // Linear filtering should be restored. 45 // Linear filtering should be restored.
46 EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, G raphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); 46 EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FI LTER, GL_LINEAR));
47 EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, G raphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); 47 EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FI LTER, GL_LINEAR));
48 48
49 // Default framebuffer should be restored 49 // Default framebuffer should be restored
50 EXPECT_CALL(*mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER , 0)); 50 EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, 0));
51 } 51 }
52 52
53 int sourceTextureId = 1; 53 int sourceTextureId = 1;
54 int destTextureId = 2; 54 int destTextureId = 2;
55 IntSize size(256, 128); 55 IntSize size(256, 128);
56 OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(moc kContext.get(), false)); 56 OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(moc kContext.get(), false));
57 TextureCopier::Parameters copy = { sourceTextureId, destTextureId, size }; 57 TextureCopier::Parameters copy = { sourceTextureId, destTextureId, size };
58 copier->copyTexture(copy); 58 copier->copyTexture(copy);
59 } 59 }
OLDNEW
« no previous file with comments | « cc/texture_copier.cc ('k') | cc/texture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698