| 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/prioritized_texture.h" | 7 #include "cc/prioritized_texture.h" |
| 8 | 8 |
| 9 #include "cc/prioritized_texture_manager.h" | 9 #include "cc/prioritized_texture_manager.h" |
| 10 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 10 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
| 11 #include "cc/test/fake_graphics_context.h" | 11 #include "cc/test/fake_graphics_context.h" |
| 12 #include "cc/test/tiled_layer_test_common.h" | 12 #include "cc/test/tiled_layer_test_common.h" |
| 13 #include "cc/test/web_compositor_initializer.h" | |
| 14 #include "cc/texture.h" | 13 #include "cc/texture.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 using namespace cc; | 16 using namespace cc; |
| 18 using namespace WebKitTests; | 17 using namespace WebKitTests; |
| 19 | 18 |
| 20 namespace cc { | 19 namespace cc { |
| 21 | 20 |
| 22 class PrioritizedTextureTest : public testing::Test { | 21 class PrioritizedTextureTest : public testing::Test { |
| 23 public: | 22 public: |
| 24 PrioritizedTextureTest() | 23 PrioritizedTextureTest() |
| 25 : m_textureSize(256, 256) | 24 : m_textureSize(256, 256) |
| 26 , m_textureFormat(GL_RGBA) | 25 , m_textureFormat(GL_RGBA) |
| 27 , m_compositorInitializer(0) | |
| 28 , m_context(WebKit::createFakeGraphicsContext()) | 26 , m_context(WebKit::createFakeGraphicsContext()) |
| 29 { | 27 { |
| 30 DebugScopedSetImplThread implThread; | 28 DebugScopedSetImplThread implThread; |
| 31 m_resourceProvider = ResourceProvider::create(m_context.get()); | 29 m_resourceProvider = ResourceProvider::create(m_context.get()); |
| 32 } | 30 } |
| 33 | 31 |
| 34 virtual ~PrioritizedTextureTest() | 32 virtual ~PrioritizedTextureTest() |
| 35 { | 33 { |
| 36 DebugScopedSetImplThread implThread; | 34 DebugScopedSetImplThread implThread; |
| 37 m_resourceProvider.reset(); | 35 m_resourceProvider.reset(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 84 } |
| 87 | 85 |
| 88 bool textureBackingIsAbovePriorityCutoff(PrioritizedTexture* texture) | 86 bool textureBackingIsAbovePriorityCutoff(PrioritizedTexture* texture) |
| 89 { | 87 { |
| 90 return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate(); | 88 return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate(); |
| 91 } | 89 } |
| 92 | 90 |
| 93 protected: | 91 protected: |
| 94 const IntSize m_textureSize; | 92 const IntSize m_textureSize; |
| 95 const GLenum m_textureFormat; | 93 const GLenum m_textureFormat; |
| 96 WebCompositorInitializer m_compositorInitializer; | |
| 97 scoped_ptr<GraphicsContext> m_context; | 94 scoped_ptr<GraphicsContext> m_context; |
| 98 scoped_ptr<ResourceProvider> m_resourceProvider; | 95 scoped_ptr<ResourceProvider> m_resourceProvider; |
| 99 }; | 96 }; |
| 100 | 97 |
| 101 } | 98 } |
| 102 | 99 |
| 103 namespace { | 100 namespace { |
| 104 | 101 |
| 105 TEST_F(PrioritizedTextureTest, requestTextureExceedingMaxLimit) | 102 TEST_F(PrioritizedTextureTest, requestTextureExceedingMaxLimit) |
| 106 { | 103 { |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleBytes()); | 696 EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleBytes()); |
| 700 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryVisibleAndNearbyB
ytes()); | 697 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryVisibleAndNearbyB
ytes()); |
| 701 } | 698 } |
| 702 | 699 |
| 703 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 700 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 704 textureManager->clearAllMemory(resourceProvider()); | 701 textureManager->clearAllMemory(resourceProvider()); |
| 705 } | 702 } |
| 706 | 703 |
| 707 | 704 |
| 708 } // namespace | 705 } // namespace |
| OLD | NEW |