OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/scheduler/texture_uploader.h" | 5 #include "cc/scheduler/texture_uploader.h" |
6 | 6 |
7 #include "cc/base/util.h" | 7 #include "cc/base/util.h" |
8 #include "cc/resources/prioritized_resource.h" | 8 #include "cc/resources/prioritized_resource.h" |
9 #include "cc/test/test_web_graphics_context_3d.h" | 9 #include "cc/test/test_web_graphics_context_3d.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 unsigned result_available_; | 144 unsigned result_available_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(TestWebGraphicsContext3DTextureUpload); | 146 DISALLOW_COPY_AND_ASSIGN(TestWebGraphicsContext3DTextureUpload); |
147 }; | 147 }; |
148 | 148 |
149 void UploadTexture(TextureUploader* uploader, | 149 void UploadTexture(TextureUploader* uploader, |
150 WGC3Denum format, | 150 WGC3Denum format, |
151 gfx::Size size, | 151 gfx::Size size, |
152 const uint8* data) { | 152 const uint8* data) { |
153 uploader->Upload(data, | 153 uploader->Upload(data, |
154 gfx::Rect(gfx::Point(), size), | 154 gfx::Rect(size), |
155 gfx::Rect(gfx::Point(), size), | 155 gfx::Rect(size), |
156 gfx::Vector2d(), | 156 gfx::Vector2d(), |
157 format, | 157 format, |
158 size); | 158 size); |
159 } | 159 } |
160 | 160 |
161 TEST(TextureUploaderTest, NumBlockingUploads) { | 161 TEST(TextureUploaderTest, NumBlockingUploads) { |
162 scoped_ptr<TestWebGraphicsContext3DTextureUpload> fake_context( | 162 scoped_ptr<TestWebGraphicsContext3DTextureUpload> fake_context( |
163 new TestWebGraphicsContext3DTextureUpload); | 163 new TestWebGraphicsContext3DTextureUpload); |
164 scoped_ptr<TextureUploader> uploader = | 164 scoped_ptr<TextureUploader> uploader = |
165 TextureUploader::Create(fake_context.get(), false, false); | 165 TextureUploader::Create(fake_context.get(), false, false); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 for (int i = 0; i < 86; ++i) { | 234 for (int i = 0; i < 86; ++i) { |
235 // Mark the beginning and end of each row, for the test. | 235 // Mark the beginning and end of each row, for the test. |
236 buffer[i * 1 * 82] = 0x1; | 236 buffer[i * 1 * 82] = 0x1; |
237 buffer[(i + 1) * 82 - 1] = 0x2; | 237 buffer[(i + 1) * 82 - 1] = 0x2; |
238 } | 238 } |
239 UploadTexture(uploader.get(), GL_LUMINANCE, gfx::Size(82, 86), buffer); | 239 UploadTexture(uploader.get(), GL_LUMINANCE, gfx::Size(82, 86), buffer); |
240 } | 240 } |
241 | 241 |
242 } // namespace | 242 } // namespace |
243 } // namespace cc | 243 } // namespace cc |
OLD | NEW |