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

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

Issue 2037983003: gl: Check format is valid given an internal format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make validation as restrictive as possible. 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_ozone_native_pixmap.cc ('k') | no next file » | 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 "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/buffer_types.h" 8 #include "ui/gfx/buffer_types.h"
9 #include "ui/gl/gl_image_ozone_native_pixmap.h" 9 #include "ui/gl/gl_image_ozone_native_pixmap.h"
10 #include "ui/gl/test/gl_image_test_template.h" 10 #include "ui/gl/test/gl_image_test_template.h"
(...skipping 26 matching lines...) Expand all
37 auto client_pixmap = client_pixmap_factory_->ImportFromHandle( 37 auto client_pixmap = client_pixmap_factory_->ImportFromHandle(
38 pixmap->ExportHandle(), size, usage); 38 pixmap->ExportHandle(), size, usage);
39 void* data = client_pixmap->Map(); 39 void* data = client_pixmap->Map();
40 EXPECT_TRUE(data); 40 EXPECT_TRUE(data);
41 GLImageTestSupport::SetBufferDataToColor( 41 GLImageTestSupport::SetBufferDataToColor(
42 size.width(), size.height(), pixmap->GetDmaBufPitch(0), 0, 42 size.width(), size.height(), pixmap->GetDmaBufPitch(0), 0,
43 pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data)); 43 pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data));
44 client_pixmap->Unmap(); 44 client_pixmap->Unmap();
45 } 45 }
46 46
47 scoped_refptr<GLImageOzoneNativePixmap> image( 47 scoped_refptr<GLImageOzoneNativePixmap> image(new GLImageOzoneNativePixmap(
48 new GLImageOzoneNativePixmap(size, GL_RGBA)); 48 size, GLImageOzoneNativePixmap::GetInternalFormatForTesting(format)));
49 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); 49 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat()));
50 return image; 50 return image;
51 } 51 }
52 52
53 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } 53 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; }
54 54
55 const uint8_t* GetImageColor() { 55 const uint8_t* GetImageColor() {
56 return format == gfx::BufferFormat::R_8 ? kRed : kGreen; 56 return format == gfx::BufferFormat::R_8 ? kRed : kGreen;
57 } 57 }
58 58
(...skipping 28 matching lines...) Expand all
87 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapReadWrite, 87 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapReadWrite,
88 GLImageTest, 88 GLImageTest,
89 GLImageReadWriteType); 89 GLImageReadWriteType);
90 90
91 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmap, 91 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmap,
92 GLImageBindTest, 92 GLImageBindTest,
93 GLImageBindTestTypes); 93 GLImageBindTestTypes);
94 94
95 } // namespace 95 } // namespace
96 } // namespace gl 96 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_image_ozone_native_pixmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698