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

Side by Side Diff: cc/texture_copier_unittest.cc

Issue 12912006: Part 4 of cc/ directory shuffles: output (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/texture_copier.h"
6
7 #include "cc/test/test_web_graphics_context_3d.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/khronos/GLES2/gl2.h"
11
12 using namespace WebKit;
13 using testing::InSequence;
14 using testing::Test;
15 using testing::_;
16
17 namespace cc {
18 namespace {
19
20 class MockContext : public TestWebGraphicsContext3D {
21 public:
22 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId));
23 MOCK_METHOD3(texParameteri,
24 void(WGC3Denum target, WGC3Denum pname, WGC3Dint param));
25 MOCK_METHOD1(disable, void(WGC3Denum cap));
26 MOCK_METHOD1(enable, void(WGC3Denum cap));
27
28 MOCK_METHOD3(drawArrays,
29 void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count));
30 };
31
32 TEST(TextureCopierTest, TestDrawArraysCopy) {
33 scoped_ptr<MockContext> mock_context(new MockContext);
34 {
35 InSequence sequence;
36
37 EXPECT_CALL(*mock_context, disable(GL_SCISSOR_TEST));
38
39 // Here we check just some essential properties of copyTexture() to avoid mi rroring the full implementation.
40 EXPECT_CALL(*mock_context, bindFramebuffer(GL_FRAMEBUFFER, _));
41
42 // Make sure linear filtering is disabled during the copy.
43 EXPECT_CALL(
44 *mock_context,
45 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
46 EXPECT_CALL(
47 *mock_context,
48 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
49
50 EXPECT_CALL(*mock_context, disable(GL_BLEND));
51
52 EXPECT_CALL(*mock_context, drawArrays(_, _, _));
53
54 // Linear filtering, default framebuffer and scissor test should be restored .
55 EXPECT_CALL(*mock_context,
56 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
57 EXPECT_CALL(*mock_context,
58 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
59 EXPECT_CALL(*mock_context, bindFramebuffer(GL_FRAMEBUFFER, 0));
60 EXPECT_CALL(*mock_context, enable(GL_SCISSOR_TEST));
61 }
62
63 int source_texture_id = mock_context->createTexture();
64 int dest_texture_id = mock_context->createTexture();
65 gfx::Size size(256, 128);
66 scoped_ptr<AcceleratedTextureCopier> copier(
67 AcceleratedTextureCopier::Create(mock_context.get(), false));
68 TextureCopier::Parameters copy = { source_texture_id, dest_texture_id, size };
69 copier->CopyTexture(copy);
70 }
71
72 } // namespace
73 } // namespace cc
OLDNEW
« no previous file with comments | « cc/texture_copier.cc ('k') | cc/texture_layer_impl.cc » ('j') | content/common/view_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698