OLD | NEW |
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->willUse(); | 240 layer->didDraw(); |
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->willUse(); | 244 layer->didDraw(); |
245 layer->skippedPendingDrawCommands(); | 245 layer->skippedPendingDrawCommands(); |
246 } | 246 } |
247 blink::Platform::current()->currentThread()->exitRunLoop(); | 247 blink::Platform::current()->currentThread()->exitRunLoop(); |
248 } | 248 } |
249 | 249 |
250 class DeferredFrameTestTask : public blink::WebThread::Task { | 250 class DeferredFrameTestTask : public blink::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; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |