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

Side by Side Diff: ui/gl/gl_image_ref_counted_memory_unittest.cc

Issue 2014223002: Follow-up fixes to changing namespace gfx to gl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 6 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
« no previous file with comments | « ui/gl/gl_image_ref_counted_memory.h ('k') | ui/gl/gl_image_shared_memory_unittest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gl/gl_image_ref_counted_memory.h" 11 #include "ui/gl/gl_image_ref_counted_memory.h"
12 #include "ui/gl/test/gl_image_test_template.h" 12 #include "ui/gl/test/gl_image_test_template.h"
13 13
14 namespace gl { 14 namespace gl {
15 namespace { 15 namespace {
16 16
17 template <gfx::BufferFormat format> 17 template <gfx::BufferFormat format>
18 class GLImageRefCountedMemoryTestDelegate { 18 class GLImageRefCountedMemoryTestDelegate {
19 public: 19 public:
20 scoped_refptr<gl::GLImage> CreateSolidColorImage( 20 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size,
21 const gfx::Size& size, 21 const uint8_t color[4]) const {
22 const uint8_t color[4]) const {
23 DCHECK_EQ(NumberOfPlanesForBufferFormat(format), 1u); 22 DCHECK_EQ(NumberOfPlanesForBufferFormat(format), 1u);
24 std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format)); 23 std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format));
25 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data)); 24 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data));
26 GLImageTestSupport::SetBufferDataToColor( 25 GLImageTestSupport::SetBufferDataToColor(
27 size.width(), size.height(), 26 size.width(), size.height(),
28 static_cast<int>(RowSizeForBufferFormat(size.width(), format, 0)), 0, 27 static_cast<int>(RowSizeForBufferFormat(size.width(), format, 0)), 0,
29 format, color, &bytes->data().front()); 28 format, color, &bytes->data().front());
30 scoped_refptr<GLImageRefCountedMemory> image(new GLImageRefCountedMemory( 29 scoped_refptr<GLImageRefCountedMemory> image(new GLImageRefCountedMemory(
31 size, gl::GLImageMemory::GetInternalFormatForTesting(format))); 30 size, GLImageMemory::GetInternalFormatForTesting(format)));
32 bool rv = image->Initialize(bytes.get(), format); 31 bool rv = image->Initialize(bytes.get(), format);
33 EXPECT_TRUE(rv); 32 EXPECT_TRUE(rv);
34 return image; 33 return image;
35 } 34 }
36 35
37 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } 36 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; }
38 }; 37 };
39 38
40 using GLImageTestTypes = testing::Types< 39 using GLImageTestTypes = testing::Types<
41 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBX_8888>, 40 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBX_8888>,
42 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBA_8888>, 41 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBA_8888>,
43 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRX_8888>, 42 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRX_8888>,
44 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRA_8888>>; 43 GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRA_8888>>;
45 44
46 INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory, 45 INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory,
47 GLImageTest, 46 GLImageTest,
48 GLImageTestTypes); 47 GLImageTestTypes);
49 48
50 INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory, 49 INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory,
51 GLImageCopyTest, 50 GLImageCopyTest,
52 GLImageTestTypes); 51 GLImageTestTypes);
53 52
54 } // namespace 53 } // namespace
55 } // namespace gl 54 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_image_ref_counted_memory.h ('k') | ui/gl/gl_image_shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698