OLD | NEW |
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/texture_copier.h" | 7 #include "cc/texture_copier.h" |
8 | 8 |
9 #include "cc/test/fake_web_graphics_context_3d.h" | 9 #include "cc/test/fake_web_graphics_context_3d.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/khronos/GLES2/gl2.h" | 12 #include "third_party/khronos/GLES2/gl2.h" |
13 | 13 |
14 using namespace cc; | 14 using namespace cc; |
15 using namespace WebKit; | 15 using namespace WebKit; |
16 using testing::InSequence; | 16 using testing::InSequence; |
17 using testing::Test; | 17 using testing::Test; |
18 using testing::_; | 18 using testing::_; |
19 | 19 |
| 20 namespace { |
| 21 |
20 class MockContext : public FakeWebGraphicsContext3D { | 22 class MockContext : public FakeWebGraphicsContext3D { |
21 public: | 23 public: |
22 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId)); | 24 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId)); |
23 MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint
param)); | 25 MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint
param)); |
24 | 26 |
25 MOCK_METHOD3(drawArrays, void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei cou
nt)); | 27 MOCK_METHOD3(drawArrays, void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei cou
nt)); |
26 }; | 28 }; |
27 | 29 |
28 TEST(TextureCopierTest, testDrawArraysCopy) | 30 TEST(TextureCopierTest, testDrawArraysCopy) |
29 { | 31 { |
(...skipping 19 matching lines...) Expand all Loading... |
49 EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, 0)); | 51 EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, 0)); |
50 } | 52 } |
51 | 53 |
52 int sourceTextureId = 1; | 54 int sourceTextureId = 1; |
53 int destTextureId = 2; | 55 int destTextureId = 2; |
54 gfx::Size size(256, 128); | 56 gfx::Size size(256, 128); |
55 scoped_ptr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create
(mockContext.get(), false)); | 57 scoped_ptr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create
(mockContext.get(), false)); |
56 TextureCopier::Parameters copy = { sourceTextureId, destTextureId, size }; | 58 TextureCopier::Parameters copy = { sourceTextureId, destTextureId, size }; |
57 copier->copyTexture(copy); | 59 copier->copyTexture(copy); |
58 } | 60 } |
| 61 |
| 62 } // anonymous namespace |
OLD | NEW |