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

Side by Side Diff: Source/platform/graphics/Canvas2DLayerManagerTest.cpp

Issue 464273002: Cleanup namespace usage in platform/graphics/[filters/* to skia/*] and platform/graphics/[B-D]* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 25 matching lines...) Expand all
36 #include <gmock/gmock.h> 36 #include <gmock/gmock.h>
37 #include <gtest/gtest.h> 37 #include <gtest/gtest.h>
38 38
39 using namespace blink; 39 using namespace blink;
40 using testing::InSequence; 40 using testing::InSequence;
41 using testing::Return; 41 using testing::Return;
42 using testing::Test; 42 using testing::Test;
43 43
44 namespace { 44 namespace {
45 45
46 class MockWebGraphicsContext3DProvider : public blink::WebGraphicsContext3DProvi der { 46 class MockWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider {
47 public: 47 public:
48 MockWebGraphicsContext3DProvider(blink::WebGraphicsContext3D* context3d) 48 MockWebGraphicsContext3DProvider(WebGraphicsContext3D* context3d)
49 : m_context3d(context3d) { } 49 : m_context3d(context3d) { }
50 50
51 blink::WebGraphicsContext3D* context3d() 51 WebGraphicsContext3D* context3d()
52 { 52 {
53 return m_context3d; 53 return m_context3d;
54 } 54 }
55 55
56 GrContext* grContext() 56 GrContext* grContext()
57 { 57 {
58 return 0; 58 return 0;
59 } 59 }
60 60
61 private: 61 private:
62 blink::WebGraphicsContext3D* m_context3d; 62 WebGraphicsContext3D* m_context3d;
63 }; 63 };
64 64
65 class FakeCanvas2DLayerBridge : public Canvas2DLayerBridge { 65 class FakeCanvas2DLayerBridge : public Canvas2DLayerBridge {
66 public: 66 public:
67 FakeCanvas2DLayerBridge(blink::WebGraphicsContext3D* context, PassOwnPtr<SkD eferredCanvas> canvas, PassRefPtr<SkSurface> surface) 67 FakeCanvas2DLayerBridge(WebGraphicsContext3D* context, PassOwnPtr<SkDeferred Canvas> canvas, PassRefPtr<SkSurface> surface)
68 : Canvas2DLayerBridge(adoptPtr(new MockWebGraphicsContext3DProvider(cont ext)), canvas, surface, 0, NonOpaque) 68 : Canvas2DLayerBridge(adoptPtr(new MockWebGraphicsContext3DProvider(cont ext)), canvas, surface, 0, NonOpaque)
69 , m_freeableBytes(0) 69 , m_freeableBytes(0)
70 , m_freeMemoryIfPossibleCount(0) 70 , m_freeMemoryIfPossibleCount(0)
71 , m_flushCount(0) 71 , m_flushCount(0)
72 { 72 {
73 } 73 }
74 74
75 virtual size_t storageAllocatedForRecording() OVERRIDE 75 virtual size_t storageAllocatedForRecording() OVERRIDE
76 { 76 {
77 // Because the fake layer has no canvas to query, just 77 // Because the fake layer has no canvas to query, just
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 } // unnamed namespace 129 } // unnamed namespace
130 130
131 class Canvas2DLayerManagerTest : public Test { 131 class Canvas2DLayerManagerTest : public Test {
132 protected: 132 protected:
133 void storageAllocationTrackingTest() 133 void storageAllocationTrackingTest()
134 { 134 {
135 Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); 135 Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
136 manager.init(10, 10); 136 manager.init(10, 10);
137 { 137 {
138 OwnPtr<blink::MockWebGraphicsContext3D> webContext = adoptPtr(new bl ink::MockWebGraphicsContext3D); 138 OwnPtr<MockWebGraphicsContext3D> webContext = adoptPtr(new MockWebGr aphicsContext3D);
139 RefPtr<SkSurface> surface1 = adoptRef(SkSurface::NewRasterPMColor(1, 1)); 139 RefPtr<SkSurface> surface1 = adoptRef(SkSurface::NewRasterPMColor(1, 1));
140 OwnPtr<SkDeferredCanvas> canvas1 = adoptPtr(SkDeferredCanvas::Create (surface1.get())); 140 OwnPtr<SkDeferredCanvas> canvas1 = adoptPtr(SkDeferredCanvas::Create (surface1.get()));
141 FakeCanvas2DLayerBridgePtr layer1(adoptRef(new FakeCanvas2DLayerBrid ge(webContext.get(), canvas1.release(), surface1.release()))); 141 FakeCanvas2DLayerBridgePtr layer1(adoptRef(new FakeCanvas2DLayerBrid ge(webContext.get(), canvas1.release(), surface1.release())));
142 EXPECT_EQ((size_t)0, manager.m_bytesAllocated); 142 EXPECT_EQ((size_t)0, manager.m_bytesAllocated);
143 layer1->storageAllocatedForRecordingChanged(1); 143 layer1->storageAllocatedForRecordingChanged(1);
144 EXPECT_EQ((size_t)1, manager.m_bytesAllocated); 144 EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
145 // Test allocation increase 145 // Test allocation increase
146 layer1->storageAllocatedForRecordingChanged(2); 146 layer1->storageAllocatedForRecordingChanged(2);
147 EXPECT_EQ((size_t)2, manager.m_bytesAllocated); 147 EXPECT_EQ((size_t)2, manager.m_bytesAllocated);
148 // Test allocation decrease 148 // Test allocation decrease
149 layer1->storageAllocatedForRecordingChanged(1); 149 layer1->storageAllocatedForRecordingChanged(1);
150 EXPECT_EQ((size_t)1, manager.m_bytesAllocated); 150 EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
151 { 151 {
152 RefPtr<SkSurface> surface2 = adoptRef(SkSurface::NewRasterPMColo r(1, 1)); 152 RefPtr<SkSurface> surface2 = adoptRef(SkSurface::NewRasterPMColo r(1, 1));
153 OwnPtr<SkDeferredCanvas> canvas2 = adoptPtr(SkDeferredCanvas::Cr eate(surface2.get())); 153 OwnPtr<SkDeferredCanvas> canvas2 = adoptPtr(SkDeferredCanvas::Cr eate(surface2.get()));
154 FakeCanvas2DLayerBridgePtr layer2(adoptRef(new FakeCanvas2DLayer Bridge(webContext.get(), canvas2.release(), surface2.release()))); 154 FakeCanvas2DLayerBridgePtr layer2(adoptRef(new FakeCanvas2DLayer Bridge(webContext.get(), canvas2.release(), surface2.release())));
155 EXPECT_EQ((size_t)1, manager.m_bytesAllocated); 155 EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
156 // verify multi-layer allocation tracking 156 // verify multi-layer allocation tracking
157 layer2->storageAllocatedForRecordingChanged(2); 157 layer2->storageAllocatedForRecordingChanged(2);
158 EXPECT_EQ((size_t)3, manager.m_bytesAllocated); 158 EXPECT_EQ((size_t)3, manager.m_bytesAllocated);
159 } 159 }
160 // Verify tracking after destruction 160 // Verify tracking after destruction
161 EXPECT_EQ((size_t)1, manager.m_bytesAllocated); 161 EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
162 } 162 }
163 } 163 }
164 164
165 void evictionTest() 165 void evictionTest()
166 { 166 {
167 OwnPtr<blink::MockWebGraphicsContext3D> webContext = adoptPtr(new blink: :MockWebGraphicsContext3D); 167 OwnPtr<MockWebGraphicsContext3D> webContext = adoptPtr(new MockWebGraphi csContext3D);
168 Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); 168 Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
169 manager.init(10, 5); 169 manager.init(10, 5);
170 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1)); 170 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1));
171 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get())); 171 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get()));
172 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release()))); 172 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release())));
173 layer->fakeFreeableBytes(10); 173 layer->fakeFreeableBytes(10);
174 layer->storageAllocatedForRecordingChanged(8); // under the max 174 layer->storageAllocatedForRecordingChanged(8); // under the max
175 EXPECT_EQ(0, layer->m_freeMemoryIfPossibleCount); 175 EXPECT_EQ(0, layer->m_freeMemoryIfPossibleCount);
176 layer->storageAllocatedForRecordingChanged(12); // over the max 176 layer->storageAllocatedForRecordingChanged(12); // over the max
177 EXPECT_EQ(1, layer->m_freeMemoryIfPossibleCount); 177 EXPECT_EQ(1, layer->m_freeMemoryIfPossibleCount);
178 EXPECT_EQ((size_t)3, layer->m_freeableBytes); 178 EXPECT_EQ((size_t)3, layer->m_freeableBytes);
179 EXPECT_EQ(0, layer->m_flushCount); // eviction succeeded without trigger ing a flush 179 EXPECT_EQ(0, layer->m_flushCount); // eviction succeeded without trigger ing a flush
180 EXPECT_EQ((size_t)5, layer->bytesAllocated()); 180 EXPECT_EQ((size_t)5, layer->bytesAllocated());
181 } 181 }
182 182
183 void hiddenCanvasTest() 183 void hiddenCanvasTest()
184 { 184 {
185 OwnPtr<blink::MockWebGraphicsContext3D> webContext = adoptPtr(new blink: :MockWebGraphicsContext3D); 185 OwnPtr<MockWebGraphicsContext3D> webContext = adoptPtr(new MockWebGraphi csContext3D);
186 Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); 186 Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
187 manager.init(20, 5); 187 manager.init(20, 5);
188 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1)); 188 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1));
189 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get())); 189 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get()));
190 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release()))); 190 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release())));
191 layer->fakeFreeableBytes(5); 191 layer->fakeFreeableBytes(5);
192 layer->storageAllocatedForRecordingChanged(10); 192 layer->storageAllocatedForRecordingChanged(10);
193 EXPECT_EQ(0, layer->m_freeMemoryIfPossibleCount); 193 EXPECT_EQ(0, layer->m_freeMemoryIfPossibleCount);
194 EXPECT_EQ(0, layer->m_flushCount); 194 EXPECT_EQ(0, layer->m_flushCount);
195 EXPECT_EQ((size_t)10, layer->bytesAllocated()); 195 EXPECT_EQ((size_t)10, layer->bytesAllocated());
196 layer->setIsHidden(true); 196 layer->setIsHidden(true);
197 EXPECT_EQ(1, layer->m_freeMemoryIfPossibleCount); 197 EXPECT_EQ(1, layer->m_freeMemoryIfPossibleCount);
198 EXPECT_EQ((size_t)0, layer->m_freeableBytes); 198 EXPECT_EQ((size_t)0, layer->m_freeableBytes);
199 EXPECT_EQ((size_t)0, layer->bytesAllocated()); 199 EXPECT_EQ((size_t)0, layer->bytesAllocated());
200 EXPECT_EQ(1, layer->m_flushCount); 200 EXPECT_EQ(1, layer->m_flushCount);
201 } 201 }
202 202
203 void addRemoveLayerTest() 203 void addRemoveLayerTest()
204 { 204 {
205 OwnPtr<blink::MockWebGraphicsContext3D> webContext = adoptPtr(new blink: :MockWebGraphicsContext3D); 205 OwnPtr<MockWebGraphicsContext3D> webContext = adoptPtr(new MockWebGraphi csContext3D);
206 Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); 206 Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
207 manager.init(10, 5); 207 manager.init(10, 5);
208 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1)); 208 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1));
209 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get())); 209 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get()));
210 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release()))); 210 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release())));
211 EXPECT_FALSE(manager.isInList(layer.get())); 211 EXPECT_FALSE(manager.isInList(layer.get()));
212 layer->storageAllocatedForRecordingChanged(5); 212 layer->storageAllocatedForRecordingChanged(5);
213 EXPECT_TRUE(manager.isInList(layer.get())); 213 EXPECT_TRUE(manager.isInList(layer.get()));
214 layer->storageAllocatedForRecordingChanged(0); 214 layer->storageAllocatedForRecordingChanged(0);
215 EXPECT_FALSE(manager.isInList(layer.get())); 215 EXPECT_FALSE(manager.isInList(layer.get()));
216 } 216 }
217 217
218 void flushEvictionTest() 218 void flushEvictionTest()
219 { 219 {
220 OwnPtr<blink::MockWebGraphicsContext3D> webContext = adoptPtr(new blink: :MockWebGraphicsContext3D); 220 OwnPtr<MockWebGraphicsContext3D> webContext = adoptPtr(new MockWebGraphi csContext3D);
221 Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); 221 Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
222 manager.init(10, 5); 222 manager.init(10, 5);
223 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1)); 223 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1));
224 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get())); 224 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get()));
225 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release()))); 225 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release())));
226 layer->fakeFreeableBytes(1); // Not enough freeable bytes, will cause ag gressive eviction by flushing 226 layer->fakeFreeableBytes(1); // Not enough freeable bytes, will cause ag gressive eviction by flushing
227 layer->storageAllocatedForRecordingChanged(8); // under the max 227 layer->storageAllocatedForRecordingChanged(8); // under the max
228 EXPECT_EQ(0, layer->m_freeMemoryIfPossibleCount); 228 EXPECT_EQ(0, layer->m_freeMemoryIfPossibleCount);
229 layer->storageAllocatedForRecordingChanged(12); // over the max 229 layer->storageAllocatedForRecordingChanged(12); // over the max
230 EXPECT_EQ(2, layer->m_freeMemoryIfPossibleCount); // Two tries, one befo re flush, one after flush 230 EXPECT_EQ(2, layer->m_freeMemoryIfPossibleCount); // Two tries, one befo re flush, one after flush
231 EXPECT_EQ((size_t)5, layer->m_freeableBytes); 231 EXPECT_EQ((size_t)5, layer->m_freeableBytes);
232 EXPECT_EQ(1, layer->m_flushCount); // flush was attempted 232 EXPECT_EQ(1, layer->m_flushCount); // flush was attempted
233 EXPECT_EQ((size_t)5, layer->bytesAllocated()); 233 EXPECT_EQ((size_t)5, layer->bytesAllocated());
234 EXPECT_TRUE(manager.isInList(layer.get())); 234 EXPECT_TRUE(manager.isInList(layer.get()));
235 } 235 }
236 236
237 void doDeferredFrameTestTask(FakeCanvas2DLayerBridge* layer, bool skipComman ds) 237 void doDeferredFrameTestTask(FakeCanvas2DLayerBridge* layer, bool skipComman ds)
238 { 238 {
239 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive); 239 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
240 layer->finalizeFrame(); 240 layer->finalizeFrame();
241 layer->storageAllocatedForRecordingChanged(1); 241 layer->storageAllocatedForRecordingChanged(1);
242 EXPECT_TRUE(Canvas2DLayerManager::get().m_taskObserverActive); 242 EXPECT_TRUE(Canvas2DLayerManager::get().m_taskObserverActive);
243 if (skipCommands) { 243 if (skipCommands) {
244 layer->finalizeFrame(); 244 layer->finalizeFrame();
245 layer->skippedPendingDrawCommands(); 245 layer->skippedPendingDrawCommands();
246 } 246 }
247 blink::Platform::current()->currentThread()->exitRunLoop(); 247 Platform::current()->currentThread()->exitRunLoop();
248 } 248 }
249 249
250 class DeferredFrameTestTask : public blink::WebThread::Task { 250 class DeferredFrameTestTask : public WebThread::Task {
251 public: 251 public:
252 DeferredFrameTestTask(Canvas2DLayerManagerTest* test, FakeCanvas2DLayerB ridge* layer, bool skipCommands) 252 DeferredFrameTestTask(Canvas2DLayerManagerTest* test, FakeCanvas2DLayerB ridge* layer, bool skipCommands)
253 { 253 {
254 m_test = test; 254 m_test = test;
255 m_layer = layer; 255 m_layer = layer;
256 m_skipCommands = skipCommands; 256 m_skipCommands = skipCommands;
257 } 257 }
258 258
259 virtual void run() OVERRIDE 259 virtual void run() OVERRIDE
260 { 260 {
261 m_test->doDeferredFrameTestTask(m_layer, m_skipCommands); 261 m_test->doDeferredFrameTestTask(m_layer, m_skipCommands);
262 } 262 }
263 private: 263 private:
264 Canvas2DLayerManagerTest* m_test; 264 Canvas2DLayerManagerTest* m_test;
265 FakeCanvas2DLayerBridge* m_layer; 265 FakeCanvas2DLayerBridge* m_layer;
266 bool m_skipCommands; 266 bool m_skipCommands;
267 }; 267 };
268 268
269 void deferredFrameTest() 269 void deferredFrameTest()
270 { 270 {
271 OwnPtr<blink::MockWebGraphicsContext3D> webContext = adoptPtr(new blink: :MockWebGraphicsContext3D); 271 OwnPtr<MockWebGraphicsContext3D> webContext = adoptPtr(new MockWebGraphi csContext3D);
272 Canvas2DLayerManager::get().init(10, 10); 272 Canvas2DLayerManager::get().init(10, 10);
273 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1)); 273 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterPMColor(1, 1));
274 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get())); 274 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surf ace.get()));
275 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release()))); 275 FakeCanvas2DLayerBridgePtr layer(adoptRef(new FakeCanvas2DLayerBridge(we bContext.get(), canvas.release(), surface.release())));
276 blink::Platform::current()->currentThread()->postTask(new DeferredFrameT estTask(this, layer.get(), true)); 276 Platform::current()->currentThread()->postTask(new DeferredFrameTestTask (this, layer.get(), true));
277 blink::Platform::current()->currentThread()->enterRunLoop(); 277 Platform::current()->currentThread()->enterRunLoop();
278 // Verify that didProcessTask was called upon completion 278 // Verify that didProcessTask was called upon completion
279 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive); 279 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
280 // Verify that no flush was performed because frame is fresh 280 // Verify that no flush was performed because frame is fresh
281 EXPECT_EQ(0, layer->m_flushCount); 281 EXPECT_EQ(0, layer->m_flushCount);
282 282
283 // Verify that no flushes are triggered as long as frame are fresh 283 // Verify that no flushes are triggered as long as frame are fresh
284 blink::Platform::current()->currentThread()->postTask(new DeferredFrameT estTask(this, layer.get(), true)); 284 Platform::current()->currentThread()->postTask(new DeferredFrameTestTask (this, layer.get(), true));
285 blink::Platform::current()->currentThread()->enterRunLoop(); 285 Platform::current()->currentThread()->enterRunLoop();
286 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive); 286 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
287 EXPECT_EQ(0, layer->m_flushCount); 287 EXPECT_EQ(0, layer->m_flushCount);
288 288
289 blink::Platform::current()->currentThread()->postTask(new DeferredFrameT estTask(this, layer.get(), true)); 289 Platform::current()->currentThread()->postTask(new DeferredFrameTestTask (this, layer.get(), true));
290 blink::Platform::current()->currentThread()->enterRunLoop(); 290 Platform::current()->currentThread()->enterRunLoop();
291 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive); 291 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
292 EXPECT_EQ(0, layer->m_flushCount); 292 EXPECT_EQ(0, layer->m_flushCount);
293 293
294 // Verify that a flush is triggered when queue is accumulating a multi-f rame backlog. 294 // Verify that a flush is triggered when queue is accumulating a multi-f rame backlog.
295 blink::Platform::current()->currentThread()->postTask(new DeferredFrameT estTask(this, layer.get(), false)); 295 Platform::current()->currentThread()->postTask(new DeferredFrameTestTask (this, layer.get(), false));
296 blink::Platform::current()->currentThread()->enterRunLoop(); 296 Platform::current()->currentThread()->enterRunLoop();
297 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive); 297 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
298 EXPECT_EQ(1, layer->m_flushCount); 298 EXPECT_EQ(1, layer->m_flushCount);
299 299
300 blink::Platform::current()->currentThread()->postTask(new DeferredFrameT estTask(this, layer.get(), false)); 300 Platform::current()->currentThread()->postTask(new DeferredFrameTestTask (this, layer.get(), false));
301 blink::Platform::current()->currentThread()->enterRunLoop(); 301 Platform::current()->currentThread()->enterRunLoop();
302 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive); 302 EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
303 EXPECT_EQ(2, layer->m_flushCount); 303 EXPECT_EQ(2, layer->m_flushCount);
304 } 304 }
305 }; 305 };
306 306
307 namespace { 307 namespace {
308 308
309 TEST_F(Canvas2DLayerManagerTest, testStorageAllocationTracking) 309 TEST_F(Canvas2DLayerManagerTest, testStorageAllocationTracking)
310 { 310 {
311 storageAllocationTrackingTest(); 311 storageAllocationTrackingTest();
(...skipping 19 matching lines...) Expand all
331 hiddenCanvasTest(); 331 hiddenCanvasTest();
332 } 332 }
333 333
334 TEST_F(Canvas2DLayerManagerTest, testAddRemoveLayer) 334 TEST_F(Canvas2DLayerManagerTest, testAddRemoveLayer)
335 { 335 {
336 addRemoveLayerTest(); 336 addRemoveLayerTest();
337 } 337 }
338 338
339 } // unnamed namespace 339 } // unnamed namespace
340 340
OLDNEW
« no previous file with comments | « Source/platform/graphics/Canvas2DLayerManager.cpp ('k') | Source/platform/graphics/CrossfadeGeneratedImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698