OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2chromium.h> | 6 #include <GLES2/gl2chromium.h> |
7 #include <GLES2/gl2ext.h> | 7 #include <GLES2/gl2ext.h> |
8 #include <GLES2/gl2extchromium.h> | 8 #include <GLES2/gl2extchromium.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 static const int kImageHeight = 256; | 36 static const int kImageHeight = 256; |
37 static const int kImageBytesPerPixel = 4; | 37 static const int kImageBytesPerPixel = 4; |
38 | 38 |
39 class MockGpuMemoryBufferTest : public testing::Test { | 39 class MockGpuMemoryBufferTest : public testing::Test { |
40 protected: | 40 protected: |
41 virtual void SetUp() { | 41 virtual void SetUp() { |
42 GLManager::Options options; | 42 GLManager::Options options; |
43 image_manager_ = new ImageManager; | 43 image_manager_ = new ImageManager; |
44 image_factory_.reset( | 44 image_factory_.reset( |
45 new StrictMock<ImageFactoryMock>(image_manager_)); | 45 new StrictMock<ImageFactoryMock>(image_manager_)); |
46 options.image_manager = image_manager_; | 46 options.image_manager = image_manager_.get(); |
47 options.image_factory = image_factory_.get(); | 47 options.image_factory = image_factory_.get(); |
48 | 48 |
49 gl_.Initialize(options); | 49 gl_.Initialize(options); |
50 gl_.MakeCurrent(); | 50 gl_.MakeCurrent(); |
51 } | 51 } |
52 | 52 |
53 virtual void TearDown() { | 53 virtual void TearDown() { |
54 gl_.Destroy(); | 54 gl_.Destroy(); |
55 } | 55 } |
56 | 56 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 .RetiresOnSaturation(); | 109 .RetiresOnSaturation(); |
110 | 110 |
111 // Unmap the image. | 111 // Unmap the image. |
112 EXPECT_CALL(*gpu_memory_buffer, Unmap()) | 112 EXPECT_CALL(*gpu_memory_buffer, Unmap()) |
113 .Times(1) | 113 .Times(1) |
114 .RetiresOnSaturation(); | 114 .RetiresOnSaturation(); |
115 glUnmapImageCHROMIUM(image_id); | 115 glUnmapImageCHROMIUM(image_id); |
116 | 116 |
117 // Bind the texture and the image. | 117 // Bind the texture and the image. |
118 glBindTexture(GL_TEXTURE_2D, texture_id); | 118 glBindTexture(GL_TEXTURE_2D, texture_id); |
119 EXPECT_CALL(*gl_image, BindTexImage()) | 119 EXPECT_CALL(*gl_image.get(), BindTexImage()).Times(1).WillOnce(Return(true)) |
120 .Times(1) | |
121 .WillOnce(Return(true)) | |
122 .RetiresOnSaturation(); | 120 .RetiresOnSaturation(); |
123 EXPECT_CALL(*gl_image, GetSize()) | 121 EXPECT_CALL(*gl_image.get(), GetSize()).Times(1).WillOnce(Return(size)) |
124 .Times(1) | |
125 .WillOnce(Return(size)) | |
126 .RetiresOnSaturation(); | 122 .RetiresOnSaturation(); |
127 glBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); | 123 glBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); |
128 | 124 |
129 // Destroy the image. | 125 // Destroy the image. |
130 EXPECT_CALL(*gpu_memory_buffer, Die()) | 126 EXPECT_CALL(*gpu_memory_buffer, Die()) |
131 .Times(1) | 127 .Times(1) |
132 .RetiresOnSaturation(); | 128 .RetiresOnSaturation(); |
133 | 129 |
134 EXPECT_CALL(*image_factory_.get(), DeleteGpuMemoryBuffer(image_id)) | 130 EXPECT_CALL(*image_factory_.get(), DeleteGpuMemoryBuffer(image_id)) |
135 .Times(1) | 131 .Times(1) |
136 .RetiresOnSaturation(); | 132 .RetiresOnSaturation(); |
137 | 133 |
138 glDestroyImageCHROMIUM(image_id); | 134 glDestroyImageCHROMIUM(image_id); |
139 | 135 |
140 // Delete the texture. | 136 // Delete the texture. |
141 glDeleteTextures(1, &texture_id); | 137 glDeleteTextures(1, &texture_id); |
142 } | 138 } |
143 | 139 |
144 } // namespace gles2 | 140 } // namespace gles2 |
145 } // namespace gpu | 141 } // namespace gpu |
OLD | NEW |