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

Side by Side Diff: cc/resource_update_controller_unittest.cc

Issue 11369109: cc: Rename PrioritizedTexture to PrioritizedResource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/resource_update_controller.cc ('k') | cc/resource_update_queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/resource_update_controller.h" 7 #include "cc/resource_update_controller.h"
8 8
9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread 9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
10 #include "cc/test/fake_web_compositor_output_surface.h" 10 #include "cc/test/fake_web_compositor_output_surface.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 private: 58 private:
59 ResourceUpdateControllerTest* m_test; 59 ResourceUpdateControllerTest* m_test;
60 bool m_supportShallowFlush; 60 bool m_supportShallowFlush;
61 }; 61 };
62 62
63 63
64 class ResourceUpdateControllerTest : public Test { 64 class ResourceUpdateControllerTest : public Test {
65 public: 65 public:
66 ResourceUpdateControllerTest() 66 ResourceUpdateControllerTest()
67 : m_queue(make_scoped_ptr(new ResourceUpdateQueue)) 67 : m_queue(make_scoped_ptr(new ResourceUpdateQueue))
68 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool)) 68 , m_resourceManager(PrioritizedResourceManager::create(60*1024*1024, 102 4, Renderer::ContentPool))
69 , m_fullUploadCountExpected(0) 69 , m_fullUploadCountExpected(0)
70 , m_partialCountExpected(0) 70 , m_partialCountExpected(0)
71 , m_totalUploadCountExpected(0) 71 , m_totalUploadCountExpected(0)
72 , m_maxUploadCountPerUpdate(0) 72 , m_maxUploadCountPerUpdate(0)
73 , m_numConsecutiveFlushes(0) 73 , m_numConsecutiveFlushes(0)
74 , m_numDanglingUploads(0) 74 , m_numDanglingUploads(0)
75 , m_numTotalUploads(0) 75 , m_numTotalUploads(0)
76 , m_numTotalFlushes(0) 76 , m_numTotalFlushes(0)
77 , m_queryResultsAvailable(0) 77 , m_queryResultsAvailable(0)
78 { 78 {
79 } 79 }
80 80
81 ~ResourceUpdateControllerTest() 81 ~ResourceUpdateControllerTest()
82 { 82 {
83 DebugScopedSetImplThreadAndMainThreadBlocked 83 DebugScopedSetImplThreadAndMainThreadBlocked
84 implThreadAndMainThreadBlocked; 84 implThreadAndMainThreadBlocked;
85 m_textureManager->clearAllMemory(m_resourceProvider.get()); 85 m_resourceManager->clearAllMemory(m_resourceProvider.get());
86 } 86 }
87 87
88 public: 88 public:
89 void onFlush() 89 void onFlush()
90 { 90 {
91 // Check for back-to-back flushes. 91 // Check for back-to-back flushes.
92 EXPECT_EQ(0, m_numConsecutiveFlushes) << "Back-to-back flushes detected. "; 92 EXPECT_EQ(0, m_numConsecutiveFlushes) << "Back-to-back flushes detected. ";
93 93
94 m_numDanglingUploads = 0; 94 m_numDanglingUploads = 0;
95 m_numConsecutiveFlushes++; 95 m_numConsecutiveFlushes++;
(...skipping 23 matching lines...) Expand all
119 } 119 }
120 120
121 protected: 121 protected:
122 virtual void SetUp() 122 virtual void SetUp()
123 { 123 {
124 m_context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::We bGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this))); 124 m_context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::We bGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this)));
125 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 150); 125 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 150);
126 m_bitmap.allocPixels(); 126 m_bitmap.allocPixels();
127 127
128 for (int i = 0; i < 4; i++) { 128 for (int i = 0; i < 4; i++) {
129 m_textures[i] = PrioritizedTexture::create( 129 m_textures[i] = PrioritizedResource::create(
130 m_textureManager.get(), gfx::Size(300, 150), GL_RGBA); 130 m_resourceManager.get(), gfx::Size(300, 150), GL_RGBA);
131 m_textures[i]->setRequestPriority( 131 m_textures[i]->setRequestPriority(
132 PriorityCalculator::visiblePriority(true)); 132 PriorityCalculator::visiblePriority(true));
133 } 133 }
134 m_textureManager->prioritizeTextures(); 134 m_resourceManager->prioritizeTextures();
135 135
136 DebugScopedSetImplThread implThread; 136 DebugScopedSetImplThread implThread;
137 m_resourceProvider = ResourceProvider::create(m_context.get()); 137 m_resourceProvider = ResourceProvider::create(m_context.get());
138 } 138 }
139 139
140 140
141 void appendFullUploadsOfIndexedTextureToUpdateQueue(int count, int textureIn dex) 141 void appendFullUploadsOfIndexedTextureToUpdateQueue(int count, int textureIn dex)
142 { 142 {
143 m_fullUploadCountExpected += count; 143 m_fullUploadCountExpected += count;
144 m_totalUploadCountExpected += count; 144 m_totalUploadCountExpected += count;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void makeQueryResultAvailable() 193 void makeQueryResultAvailable()
194 { 194 {
195 m_queryResultsAvailable++; 195 m_queryResultsAvailable++;
196 } 196 }
197 197
198 protected: 198 protected:
199 // Classes required to interact and test the ResourceUpdateController 199 // Classes required to interact and test the ResourceUpdateController
200 scoped_ptr<GraphicsContext> m_context; 200 scoped_ptr<GraphicsContext> m_context;
201 scoped_ptr<ResourceProvider> m_resourceProvider; 201 scoped_ptr<ResourceProvider> m_resourceProvider;
202 scoped_ptr<ResourceUpdateQueue> m_queue; 202 scoped_ptr<ResourceUpdateQueue> m_queue;
203 scoped_ptr<PrioritizedTexture> m_textures[4]; 203 scoped_ptr<PrioritizedResource> m_textures[4];
204 scoped_ptr<PrioritizedTextureManager> m_textureManager; 204 scoped_ptr<PrioritizedResourceManager> m_resourceManager;
205 SkBitmap m_bitmap; 205 SkBitmap m_bitmap;
206 int m_queryResultsAvailable; 206 int m_queryResultsAvailable;
207 207
208 // Properties / expectations of this test 208 // Properties / expectations of this test
209 int m_fullUploadCountExpected; 209 int m_fullUploadCountExpected;
210 int m_partialCountExpected; 210 int m_partialCountExpected;
211 int m_totalUploadCountExpected; 211 int m_totalUploadCountExpected;
212 int m_maxUploadCountPerUpdate; 212 int m_maxUploadCountPerUpdate;
213 213
214 // Dynamic properties of this test 214 // Dynamic properties of this test
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (thread.hasPendingTask()) 495 if (thread.hasPendingTask())
496 runPendingTask(&thread, controller.get()); 496 runPendingTask(&thread, controller.get());
497 } 497 }
498 498
499 EXPECT_FALSE(thread.hasPendingTask()); 499 EXPECT_FALSE(thread.hasPendingTask());
500 EXPECT_TRUE(client.readyToFinalizeCalled()); 500 EXPECT_TRUE(client.readyToFinalizeCalled());
501 EXPECT_EQ(2, m_numTotalUploads); 501 EXPECT_EQ(2, m_numTotalUploads);
502 } 502 }
503 503
504 } // anonymous namespace 504 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/resource_update_controller.cc ('k') | cc/resource_update_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698