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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/resource_provider.h" | 7 #include "cc/resource_provider.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "cc/graphics_context.h" | 10 #include "cc/graphics_context.h" |
11 #include "cc/scoped_ptr_deque.h" | 11 #include "cc/scoped_ptr_deque.h" |
12 #include "cc/scoped_ptr_hash_map.h" | 12 #include "cc/scoped_ptr_hash_map.h" |
| 13 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
13 #include "cc/test/compositor_fake_web_graphics_context_3d.h" | 14 #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
14 #include "cc/test/fake_web_compositor_output_surface.h" | 15 #include "cc/test/fake_web_compositor_output_surface.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/khronos/GLES2/gl2.h" | 17 #include "third_party/khronos/GLES2/gl2.h" |
17 #include "third_party/khronos/GLES2/gl2ext.h" | 18 #include "third_party/khronos/GLES2/gl2ext.h" |
18 #include "ui/gfx/rect.h" | |
19 #include <public/WebGraphicsContext3D.h> | 19 #include <public/WebGraphicsContext3D.h> |
20 | 20 |
21 using namespace cc; | 21 using namespace cc; |
22 using namespace WebKit; | 22 using namespace WebKit; |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 size_t textureSize(const gfx::Size& size, WGC3Denum format) | 26 size_t textureSize(const gfx::Size& size, WGC3Denum format) |
27 { | 27 { |
28 unsigned int componentsPerPixel = 4; | 28 unsigned int componentsPerPixel = 4; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 | 294 |
295 void expectNumResources(int count) | 295 void expectNumResources(int count) |
296 { | 296 { |
297 EXPECT_EQ(count, static_cast<int>(m_resourceProvider->numResources())); | 297 EXPECT_EQ(count, static_cast<int>(m_resourceProvider->numResources())); |
298 if (GetParam() == ResourceProvider::GLTexture) | 298 if (GetParam() == ResourceProvider::GLTexture) |
299 EXPECT_EQ(count, context()->textureCount()); | 299 EXPECT_EQ(count, context()->textureCount()); |
300 } | 300 } |
301 | 301 |
302 protected: | 302 protected: |
| 303 DebugScopedSetImplThread implThread; |
303 scoped_ptr<ContextSharedData> m_sharedData; | 304 scoped_ptr<ContextSharedData> m_sharedData; |
304 scoped_ptr<GraphicsContext> m_context; | 305 scoped_ptr<GraphicsContext> m_context; |
305 scoped_ptr<ResourceProvider> m_resourceProvider; | 306 scoped_ptr<ResourceProvider> m_resourceProvider; |
306 }; | 307 }; |
307 | 308 |
308 TEST_P(ResourceProviderTest, Basic) | 309 TEST_P(ResourceProviderTest, Basic) |
309 { | 310 { |
310 gfx::Size size(1, 1); | 311 gfx::Size size(1, 1); |
311 WGC3Denum format = GL_RGBA; | 312 WGC3Denum format = GL_RGBA; |
312 int pool = 1; | 313 int pool = 1; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 586 } |
586 EXPECT_EQ(0u, childResourceProvider->numResources()); | 587 EXPECT_EQ(0u, childResourceProvider->numResources()); |
587 } | 588 } |
588 | 589 |
589 INSTANTIATE_TEST_CASE_P(ResourceProviderTests, | 590 INSTANTIATE_TEST_CASE_P(ResourceProviderTests, |
590 ResourceProviderTest, | 591 ResourceProviderTest, |
591 ::testing::Values(ResourceProvider::GLTexture, | 592 ::testing::Values(ResourceProvider::GLTexture, |
592 ResourceProvider::Bitmap)); | 593 ResourceProvider::Bitmap)); |
593 | 594 |
594 } // namespace | 595 } // namespace |
OLD | NEW |