Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: cc/resources/prioritized_resource_unittest.cc

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/resources/prioritized_resource.h" 5 #include "cc/resources/prioritized_resource.h"
6 6
7 #include "cc/resources/prioritized_resource_manager.h" 7 #include "cc/resources/prioritized_resource_manager.h"
8 #include "cc/resources/resource.h" 8 #include "cc/resources/resource.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
11 #include "cc/test/fake_proxy.h" 11 #include "cc/test/fake_proxy.h"
12 #include "cc/test/tiled_layer_test_common.h" 12 #include "cc/test/tiled_layer_test_common.h"
13 #include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread 13 #include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace cc { 16 namespace cc {
17 17
18 class PrioritizedResourceTest : public testing::Test { 18 class PrioritizedResourceTest : public testing::Test {
19 public: 19 public:
20 PrioritizedResourceTest() 20 PrioritizedResourceTest()
21 : texture_size_(256, 256), 21 : texture_size_(256, 256),
22 texture_format_(GL_RGBA), 22 texture_format_(RGBA_8888),
23 output_surface_(FakeOutputSurface::Create3d()) { 23 output_surface_(FakeOutputSurface::Create3d()) {
24 DebugScopedSetImplThread impl_thread(&proxy_); 24 DebugScopedSetImplThread impl_thread(&proxy_);
25 CHECK(output_surface_->BindToClient(&output_surface_client_)); 25 CHECK(output_surface_->BindToClient(&output_surface_client_));
26 resource_provider_ = cc::ResourceProvider::Create(output_surface_.get(), 0); 26 resource_provider_ = cc::ResourceProvider::Create(output_surface_.get(), 0);
27 } 27 }
28 28
29 virtual ~PrioritizedResourceTest() { 29 virtual ~PrioritizedResourceTest() {
30 DebugScopedSetImplThread impl_thread(&proxy_); 30 DebugScopedSetImplThread impl_thread(&proxy_);
31 resource_provider_.reset(); 31 resource_provider_.reset();
32 } 32 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 was_above_priority_cutoff_at_last_priority_update(); 86 was_above_priority_cutoff_at_last_priority_update();
87 } 87 }
88 88
89 size_t EvictedBackingCount(PrioritizedResourceManager* resource_manager) { 89 size_t EvictedBackingCount(PrioritizedResourceManager* resource_manager) {
90 return resource_manager->evicted_backings_.size(); 90 return resource_manager->evicted_backings_.size();
91 } 91 }
92 92
93 protected: 93 protected:
94 FakeProxy proxy_; 94 FakeProxy proxy_;
95 const gfx::Size texture_size_; 95 const gfx::Size texture_size_;
96 const GLenum texture_format_; 96 const ResourceFormat texture_format_;
97 FakeOutputSurfaceClient output_surface_client_; 97 FakeOutputSurfaceClient output_surface_client_;
98 scoped_ptr<OutputSurface> output_surface_; 98 scoped_ptr<OutputSurface> output_surface_;
99 scoped_ptr<cc::ResourceProvider> resource_provider_; 99 scoped_ptr<cc::ResourceProvider> resource_provider_;
100 }; 100 };
101 101
102 namespace { 102 namespace {
103 103
104 TEST_F(PrioritizedResourceTest, RequestTextureExceedingMaxLimit) { 104 TEST_F(PrioritizedResourceTest, RequestTextureExceedingMaxLimit) {
105 const size_t kMaxTextures = 8; 105 const size_t kMaxTextures = 8;
106 scoped_ptr<PrioritizedResourceManager> resource_manager = 106 scoped_ptr<PrioritizedResourceManager> resource_manager =
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 resource_manager->MemoryVisibleAndNearbyBytes()); 795 resource_manager->MemoryVisibleAndNearbyBytes());
796 } 796 }
797 797
798 DebugScopedSetImplThreadAndMainThreadBlocked 798 DebugScopedSetImplThreadAndMainThreadBlocked
799 impl_thread_and_main_thread_blocked(&proxy_); 799 impl_thread_and_main_thread_blocked(&proxy_);
800 resource_manager->ClearAllMemory(ResourceProvider()); 800 resource_manager->ClearAllMemory(ResourceProvider());
801 } 801 }
802 802
803 } // namespace 803 } // namespace
804 } // namespace cc 804 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698