| 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 | |
| 14 #include "cc/test/compositor_fake_web_graphics_context_3d.h" | 13 #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
| 15 #include "cc/test/fake_web_compositor_output_surface.h" | 14 #include "cc/test/fake_web_compositor_output_surface.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "third_party/khronos/GLES2/gl2.h" | 16 #include "third_party/khronos/GLES2/gl2.h" |
| 18 #include "third_party/khronos/GLES2/gl2ext.h" | 17 #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; | |
| 304 scoped_ptr<ContextSharedData> m_sharedData; | 303 scoped_ptr<ContextSharedData> m_sharedData; |
| 305 scoped_ptr<GraphicsContext> m_context; | 304 scoped_ptr<GraphicsContext> m_context; |
| 306 scoped_ptr<ResourceProvider> m_resourceProvider; | 305 scoped_ptr<ResourceProvider> m_resourceProvider; |
| 307 }; | 306 }; |
| 308 | 307 |
| 309 TEST_P(ResourceProviderTest, Basic) | 308 TEST_P(ResourceProviderTest, Basic) |
| 310 { | 309 { |
| 311 gfx::Size size(1, 1); | 310 gfx::Size size(1, 1); |
| 312 WGC3Denum format = GL_RGBA; | 311 WGC3Denum format = GL_RGBA; |
| 313 int pool = 1; | 312 int pool = 1; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 } | 585 } |
| 587 EXPECT_EQ(0u, childResourceProvider->numResources()); | 586 EXPECT_EQ(0u, childResourceProvider->numResources()); |
| 588 } | 587 } |
| 589 | 588 |
| 590 INSTANTIATE_TEST_CASE_P(ResourceProviderTests, | 589 INSTANTIATE_TEST_CASE_P(ResourceProviderTests, |
| 591 ResourceProviderTest, | 590 ResourceProviderTest, |
| 592 ::testing::Values(ResourceProvider::GLTexture, | 591 ::testing::Values(ResourceProvider::GLTexture, |
| 593 ResourceProvider::Bitmap)); | 592 ResourceProvider::Bitmap)); |
| 594 | 593 |
| 595 } // anonymous namespace | 594 } // anonymous namespace |
| OLD | NEW |