OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
8 | 8 |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/content_layer.h" | 10 #include "cc/content_layer.h" |
11 #include "cc/content_layer_client.h" | 11 #include "cc/content_layer_client.h" |
12 #include "cc/graphics_context.h" | 12 #include "cc/graphics_context.h" |
13 #include "cc/layer_tree_host_impl.h" | 13 #include "cc/layer_tree_host_impl.h" |
14 #include "cc/settings.h" | 14 #include "cc/settings.h" |
15 #include "cc/single_thread_proxy.h" | 15 #include "cc/single_thread_proxy.h" |
| 16 #include "cc/test/fake_content_layer_client.h" |
16 #include "cc/test/fake_web_compositor_output_surface.h" | 17 #include "cc/test/fake_web_compositor_output_surface.h" |
17 #include "cc/test/geometry_test_utils.h" | 18 #include "cc/test/geometry_test_utils.h" |
18 #include "cc/test/layer_tree_test_common.h" | 19 #include "cc/test/layer_tree_test_common.h" |
19 #include "cc/test/occlusion_tracker_test_common.h" | 20 #include "cc/test/occlusion_tracker_test_common.h" |
20 #include "cc/resource_update_queue.h" | 21 #include "cc/resource_update_queue.h" |
21 #include "cc/timing_function.h" | 22 #include "cc/timing_function.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "third_party/khronos/GLES2/gl2.h" | 24 #include "third_party/khronos/GLES2/gl2.h" |
24 #include "third_party/khronos/GLES2/gl2ext.h" | 25 #include "third_party/khronos/GLES2/gl2ext.h" |
25 #include "ui/gfx/point_conversions.h" | 26 #include "ui/gfx/point_conversions.h" |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 private: | 1209 private: |
1209 TestOpacityChangeLayerDelegate m_testOpacityChangeDelegate; | 1210 TestOpacityChangeLayerDelegate m_testOpacityChangeDelegate; |
1210 scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; | 1211 scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; |
1211 }; | 1212 }; |
1212 | 1213 |
1213 TEST_F(LayerTreeHostTestOpacityChange, runMultiThread) | 1214 TEST_F(LayerTreeHostTestOpacityChange, runMultiThread) |
1214 { | 1215 { |
1215 runTest(true); | 1216 runTest(true); |
1216 } | 1217 } |
1217 | 1218 |
1218 class MockContentLayerClient : public ContentLayerClient { | |
1219 public: | |
1220 bool drawsContent() const { return true; } | |
1221 MOCK_CONST_METHOD0(preserves3D, bool()); | |
1222 void paintContents(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRIDE { } | |
1223 void notifySyncRequired() { } | |
1224 }; | |
1225 | |
1226 class NoScaleContentLayer : public ContentLayer { | 1219 class NoScaleContentLayer : public ContentLayer { |
1227 public: | 1220 public: |
1228 static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client)
{ return make_scoped_refptr(new NoScaleContentLayer(client)); } | 1221 static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client)
{ return make_scoped_refptr(new NoScaleContentLayer(client)); } |
1229 | 1222 |
1230 virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); } | 1223 virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); } |
1231 virtual float contentsScaleX() const OVERRIDE { return 1.0; } | 1224 virtual float contentsScaleX() const OVERRIDE { return 1.0; } |
1232 virtual float contentsScaleY() const OVERRIDE { return 1.0; } | 1225 virtual float contentsScaleY() const OVERRIDE { return 1.0; } |
1233 | 1226 |
1234 private: | 1227 private: |
1235 explicit NoScaleContentLayer(ContentLayerClient* client) | 1228 explicit NoScaleContentLayer(ContentLayerClient* client) |
(...skipping 26 matching lines...) Expand all Loading... |
1262 virtual void afterTest() OVERRIDE | 1255 virtual void afterTest() OVERRIDE |
1263 { | 1256 { |
1264 // update() should have been called once, proving that the layer was not
skipped. | 1257 // update() should have been called once, proving that the layer was not
skipped. |
1265 EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount()); | 1258 EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount()); |
1266 | 1259 |
1267 // clear m_updateCheckLayer so LayerTreeHost dies. | 1260 // clear m_updateCheckLayer so LayerTreeHost dies. |
1268 m_updateCheckLayer = NULL; | 1261 m_updateCheckLayer = NULL; |
1269 } | 1262 } |
1270 | 1263 |
1271 private: | 1264 private: |
1272 MockContentLayerClient m_client; | 1265 FakeContentLayerClient m_client; |
1273 scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; | 1266 scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; |
1274 }; | 1267 }; |
1275 | 1268 |
1276 TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) | 1269 TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) |
1277 { | 1270 { |
1278 runTest(true); | 1271 runTest(true); |
1279 } | 1272 } |
1280 | 1273 |
1281 | 1274 |
1282 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public LayerTr
eeHostTest { | 1275 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public LayerTr
eeHostTest { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 endTest(); | 1364 endTest(); |
1372 } | 1365 } |
1373 | 1366 |
1374 virtual void afterTest() OVERRIDE | 1367 virtual void afterTest() OVERRIDE |
1375 { | 1368 { |
1376 m_rootLayer = NULL; | 1369 m_rootLayer = NULL; |
1377 m_childLayer = NULL; | 1370 m_childLayer = NULL; |
1378 } | 1371 } |
1379 | 1372 |
1380 private: | 1373 private: |
1381 MockContentLayerClient m_client; | 1374 FakeContentLayerClient m_client; |
1382 scoped_refptr<NoScaleContentLayer> m_rootLayer; | 1375 scoped_refptr<NoScaleContentLayer> m_rootLayer; |
1383 scoped_refptr<ContentLayer> m_childLayer; | 1376 scoped_refptr<ContentLayer> m_childLayer; |
1384 }; | 1377 }; |
1385 | 1378 |
1386 // Test is flaky - http://crbug.com/148490 | 1379 // Test is flaky - http://crbug.com/148490 |
1387 TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, DISABLED_runMu
ltiThread) | 1380 TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, DISABLED_runMu
ltiThread) |
1388 { | 1381 { |
1389 runTest(true); | 1382 runTest(true); |
1390 } | 1383 } |
1391 | 1384 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 virtual void layout() OVERRIDE | 1453 virtual void layout() OVERRIDE |
1461 { | 1454 { |
1462 m_layer->setNeedsDisplay(); | 1455 m_layer->setNeedsDisplay(); |
1463 } | 1456 } |
1464 | 1457 |
1465 virtual void afterTest() OVERRIDE | 1458 virtual void afterTest() OVERRIDE |
1466 { | 1459 { |
1467 } | 1460 } |
1468 | 1461 |
1469 private: | 1462 private: |
1470 MockContentLayerClient m_client; | 1463 FakeContentLayerClient m_client; |
1471 scoped_refptr<ContentLayerWithUpdateTracking> m_layer; | 1464 scoped_refptr<ContentLayerWithUpdateTracking> m_layer; |
1472 }; | 1465 }; |
1473 | 1466 |
1474 TEST_F(LayerTreeHostTestAtomicCommit, runMultiThread) | 1467 TEST_F(LayerTreeHostTestAtomicCommit, runMultiThread) |
1475 { | 1468 { |
1476 runTest(true); | 1469 runTest(true); |
1477 } | 1470 } |
1478 | 1471 |
1479 static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebT
ransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& po
sition, const gfx::Size& bounds, bool opaque) | 1472 static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebT
ransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& po
sition, const gfx::Size& bounds, bool opaque) |
1480 { | 1473 { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 NOTREACHED(); | 1600 NOTREACHED(); |
1608 break; | 1601 break; |
1609 } | 1602 } |
1610 } | 1603 } |
1611 | 1604 |
1612 virtual void afterTest() OVERRIDE | 1605 virtual void afterTest() OVERRIDE |
1613 { | 1606 { |
1614 } | 1607 } |
1615 | 1608 |
1616 private: | 1609 private: |
1617 MockContentLayerClient m_client; | 1610 FakeContentLayerClient m_client; |
1618 scoped_refptr<ContentLayerWithUpdateTracking> m_parent; | 1611 scoped_refptr<ContentLayerWithUpdateTracking> m_parent; |
1619 scoped_refptr<ContentLayerWithUpdateTracking> m_child; | 1612 scoped_refptr<ContentLayerWithUpdateTracking> m_child; |
1620 int m_numCommits; | 1613 int m_numCommits; |
1621 }; | 1614 }; |
1622 | 1615 |
1623 TEST_F(LayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread) | 1616 TEST_F(LayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread) |
1624 { | 1617 { |
1625 runTest(true); | 1618 runTest(true); |
1626 } | 1619 } |
1627 | 1620 |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 } | 2185 } |
2193 | 2186 |
2194 virtual void beginTest() OVERRIDE | 2187 virtual void beginTest() OVERRIDE |
2195 { | 2188 { |
2196 gfx::Size viewportSize(10, 10); | 2189 gfx::Size viewportSize(10, 10); |
2197 gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_de
viceScaleFactor)); | 2190 gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_de
viceScaleFactor)); |
2198 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); | 2191 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); |
2199 | 2192 |
2200 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); | 2193 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); |
2201 | 2194 |
2202 m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); | 2195 m_rootScrollLayer = ContentLayer::create(&m_fakeDelegate); |
2203 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); | 2196 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); |
2204 | 2197 |
2205 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); | 2198 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); |
2206 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2199 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2207 | 2200 |
2208 m_rootScrollLayer->setIsDrawable(true); | 2201 m_rootScrollLayer->setIsDrawable(true); |
2209 m_rootScrollLayer->setScrollable(true); | 2202 m_rootScrollLayer->setScrollable(true); |
2210 m_rootScrollLayer->setMaxScrollOffset(gfx::Vector2d(100, 100)); | 2203 m_rootScrollLayer->setMaxScrollOffset(gfx::Vector2d(100, 100)); |
2211 m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer); | 2204 m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer); |
2212 | 2205 |
2213 m_childLayer = ContentLayer::create(&m_mockDelegate); | 2206 m_childLayer = ContentLayer::create(&m_fakeDelegate); |
2214 m_childLayer->setLayerScrollClient(this); | 2207 m_childLayer->setLayerScrollClient(this); |
2215 m_childLayer->setBounds(gfx::Size(110, 110)); | 2208 m_childLayer->setBounds(gfx::Size(110, 110)); |
2216 | 2209 |
2217 // The scrolls will happen at 5, 5. If they are treated like device pixe
ls, then | 2210 // The scrolls will happen at 5, 5. If they are treated like device pixe
ls, then |
2218 // they will be at 2.5, 2.5 in logical pixels, and will miss this layer. | 2211 // they will be at 2.5, 2.5 in logical pixels, and will miss this layer. |
2219 m_childLayer->setPosition(gfx::PointF(5, 5)); | 2212 m_childLayer->setPosition(gfx::PointF(5, 5)); |
2220 m_childLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2213 m_childLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2221 | 2214 |
2222 m_childLayer->setIsDrawable(true); | 2215 m_childLayer->setIsDrawable(true); |
2223 m_childLayer->setScrollable(true); | 2216 m_childLayer->setScrollable(true); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 } | 2301 } |
2309 | 2302 |
2310 private: | 2303 private: |
2311 float m_deviceScaleFactor; | 2304 float m_deviceScaleFactor; |
2312 gfx::Vector2d m_initialScroll; | 2305 gfx::Vector2d m_initialScroll; |
2313 gfx::Vector2d m_secondScroll; | 2306 gfx::Vector2d m_secondScroll; |
2314 gfx::Vector2d m_scrollAmount; | 2307 gfx::Vector2d m_scrollAmount; |
2315 int m_rootScrolls; | 2308 int m_rootScrolls; |
2316 gfx::Vector2d m_finalScrollOffset; | 2309 gfx::Vector2d m_finalScrollOffset; |
2317 | 2310 |
2318 MockContentLayerClient m_mockDelegate; | 2311 FakeContentLayerClient m_fakeDelegate; |
2319 scoped_refptr<Layer> m_rootScrollLayer; | 2312 scoped_refptr<Layer> m_rootScrollLayer; |
2320 scoped_refptr<Layer> m_childLayer; | 2313 scoped_refptr<Layer> m_childLayer; |
2321 }; | 2314 }; |
2322 | 2315 |
2323 class LayerTreeHostTestScrollChildLayerNormalDpi : public LayerTreeHostTestScrol
lChildLayer { | 2316 class LayerTreeHostTestScrollChildLayerNormalDpi : public LayerTreeHostTestScrol
lChildLayer { |
2324 public: | 2317 public: |
2325 LayerTreeHostTestScrollChildLayerNormalDpi() : LayerTreeHostTestScrollChildL
ayer(1) { } | 2318 LayerTreeHostTestScrollChildLayerNormalDpi() : LayerTreeHostTestScrollChildL
ayer(1) { } |
2326 }; | 2319 }; |
2327 | 2320 |
2328 TEST_F(LayerTreeHostTestScrollChildLayerNormalDpi, runMultiThread) | 2321 TEST_F(LayerTreeHostTestScrollChildLayerNormalDpi, runMultiThread) |
(...skipping 23 matching lines...) Expand all Loading... |
2352 } | 2345 } |
2353 | 2346 |
2354 virtual void beginTest() OVERRIDE | 2347 virtual void beginTest() OVERRIDE |
2355 { | 2348 { |
2356 gfx::Size viewportSize(10, 10); | 2349 gfx::Size viewportSize(10, 10); |
2357 gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_de
viceScaleFactor)); | 2350 gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_de
viceScaleFactor)); |
2358 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); | 2351 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); |
2359 | 2352 |
2360 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); | 2353 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); |
2361 | 2354 |
2362 m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); | 2355 m_rootScrollLayer = ContentLayer::create(&m_fakeDelegate); |
2363 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); | 2356 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); |
2364 | 2357 |
2365 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); | 2358 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); |
2366 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2359 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2367 | 2360 |
2368 m_rootScrollLayer->setIsDrawable(true); | 2361 m_rootScrollLayer->setIsDrawable(true); |
2369 m_rootScrollLayer->setScrollable(true); | 2362 m_rootScrollLayer->setScrollable(true); |
2370 m_rootScrollLayer->setMaxScrollOffset(gfx::Vector2d(100, 100)); | 2363 m_rootScrollLayer->setMaxScrollOffset(gfx::Vector2d(100, 100)); |
2371 m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer); | 2364 m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer); |
2372 | 2365 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 EXPECT_EQ(2, m_rootScrolls); | 2434 EXPECT_EQ(2, m_rootScrolls); |
2442 } | 2435 } |
2443 | 2436 |
2444 private: | 2437 private: |
2445 float m_deviceScaleFactor; | 2438 float m_deviceScaleFactor; |
2446 gfx::Vector2d m_initialScroll; | 2439 gfx::Vector2d m_initialScroll; |
2447 gfx::Vector2d m_secondScroll; | 2440 gfx::Vector2d m_secondScroll; |
2448 gfx::Vector2d m_scrollAmount; | 2441 gfx::Vector2d m_scrollAmount; |
2449 int m_rootScrolls; | 2442 int m_rootScrolls; |
2450 | 2443 |
2451 MockContentLayerClient m_mockDelegate; | 2444 FakeContentLayerClient m_fakeDelegate; |
2452 scoped_refptr<Layer> m_rootScrollLayer; | 2445 scoped_refptr<Layer> m_rootScrollLayer; |
2453 }; | 2446 }; |
2454 | 2447 |
2455 class LayerTreeHostTestScrollRootScrollLayerNormalDpi : public LayerTreeHostTest
ScrollRootScrollLayer { | 2448 class LayerTreeHostTestScrollRootScrollLayerNormalDpi : public LayerTreeHostTest
ScrollRootScrollLayer { |
2456 public: | 2449 public: |
2457 LayerTreeHostTestScrollRootScrollLayerNormalDpi() : LayerTreeHostTestScrollR
ootScrollLayer(1) { } | 2450 LayerTreeHostTestScrollRootScrollLayerNormalDpi() : LayerTreeHostTestScrollR
ootScrollLayer(1) { } |
2458 }; | 2451 }; |
2459 | 2452 |
2460 TEST_F(LayerTreeHostTestScrollRootScrollLayerNormalDpi, runMultiThread) | 2453 TEST_F(LayerTreeHostTestScrollRootScrollLayerNormalDpi, runMultiThread) |
2461 { | 2454 { |
(...skipping 28 matching lines...) Expand all Loading... |
2490 virtual void afterTest() OVERRIDE | 2483 virtual void afterTest() OVERRIDE |
2491 { | 2484 { |
2492 } | 2485 } |
2493 }; | 2486 }; |
2494 | 2487 |
2495 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackCleanup) | 2488 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackCleanup) |
2496 | 2489 |
2497 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit : public L
ayerTreeHostTest { | 2490 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit : public L
ayerTreeHostTest { |
2498 public: | 2491 public: |
2499 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit() | 2492 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit() |
2500 : m_rootLayer(ContentLayerWithUpdateTracking::create(&m_mockDelegate)) | 2493 : m_rootLayer(ContentLayerWithUpdateTracking::create(&m_fakeDelegate)) |
2501 , m_surfaceLayer1(ContentLayerWithUpdateTracking::create(&m_mockDelegate
)) | 2494 , m_surfaceLayer1(ContentLayerWithUpdateTracking::create(&m_fakeDelegate
)) |
2502 , m_replicaLayer1(ContentLayerWithUpdateTracking::create(&m_mockDelegate
)) | 2495 , m_replicaLayer1(ContentLayerWithUpdateTracking::create(&m_fakeDelegate
)) |
2503 , m_surfaceLayer2(ContentLayerWithUpdateTracking::create(&m_mockDelegate
)) | 2496 , m_surfaceLayer2(ContentLayerWithUpdateTracking::create(&m_fakeDelegate
)) |
2504 , m_replicaLayer2(ContentLayerWithUpdateTracking::create(&m_mockDelegate
)) | 2497 , m_replicaLayer2(ContentLayerWithUpdateTracking::create(&m_fakeDelegate
)) |
2505 { | 2498 { |
2506 } | 2499 } |
2507 | 2500 |
2508 virtual void beginTest() OVERRIDE | 2501 virtual void beginTest() OVERRIDE |
2509 { | 2502 { |
2510 m_layerTreeHost->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100
)); | 2503 m_layerTreeHost->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100
)); |
2511 | 2504 |
2512 m_rootLayer->setBounds(gfx::Size(100, 100)); | 2505 m_rootLayer->setBounds(gfx::Size(100, 100)); |
2513 m_surfaceLayer1->setBounds(gfx::Size(100, 100)); | 2506 m_surfaceLayer1->setBounds(gfx::Size(100, 100)); |
2514 m_surfaceLayer1->setForceRenderSurface(true); | 2507 m_surfaceLayer1->setForceRenderSurface(true); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 | 2552 |
2560 // Clear layer references so LayerTreeHost dies. | 2553 // Clear layer references so LayerTreeHost dies. |
2561 m_rootLayer = NULL; | 2554 m_rootLayer = NULL; |
2562 m_surfaceLayer1 = NULL; | 2555 m_surfaceLayer1 = NULL; |
2563 m_replicaLayer1 = NULL; | 2556 m_replicaLayer1 = NULL; |
2564 m_surfaceLayer2 = NULL; | 2557 m_surfaceLayer2 = NULL; |
2565 m_replicaLayer2 = NULL; | 2558 m_replicaLayer2 = NULL; |
2566 } | 2559 } |
2567 | 2560 |
2568 private: | 2561 private: |
2569 MockContentLayerClient m_mockDelegate; | 2562 FakeContentLayerClient m_fakeDelegate; |
2570 scoped_refptr<ContentLayerWithUpdateTracking> m_rootLayer; | 2563 scoped_refptr<ContentLayerWithUpdateTracking> m_rootLayer; |
2571 scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer1; | 2564 scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer1; |
2572 scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer1; | 2565 scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer1; |
2573 scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer2; | 2566 scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer2; |
2574 scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer2; | 2567 scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer2; |
2575 }; | 2568 }; |
2576 | 2569 |
2577 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceNotAllocatedForLayersOuts
ideMemoryLimit) | 2570 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceNotAllocatedForLayersOuts
ideMemoryLimit) |
2578 | 2571 |
2579 class EvictionTestLayer : public Layer { | 2572 class EvictionTestLayer : public Layer { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 NOTREACHED(); | 2771 NOTREACHED(); |
2779 break; | 2772 break; |
2780 } | 2773 } |
2781 } | 2774 } |
2782 | 2775 |
2783 virtual void afterTest() OVERRIDE | 2776 virtual void afterTest() OVERRIDE |
2784 { | 2777 { |
2785 } | 2778 } |
2786 | 2779 |
2787 private: | 2780 private: |
2788 MockContentLayerClient m_client; | 2781 FakeContentLayerClient m_client; |
2789 scoped_refptr<EvictionTestLayer> m_layer; | 2782 scoped_refptr<EvictionTestLayer> m_layer; |
2790 LayerTreeHostImpl* m_implForEvictTextures; | 2783 LayerTreeHostImpl* m_implForEvictTextures; |
2791 int m_numCommits; | 2784 int m_numCommits; |
2792 }; | 2785 }; |
2793 | 2786 |
2794 TEST_F(LayerTreeHostTestEvictTextures, runMultiThread) | 2787 TEST_F(LayerTreeHostTestEvictTextures, runMultiThread) |
2795 { | 2788 { |
2796 runTest(true); | 2789 runTest(true); |
2797 } | 2790 } |
2798 | 2791 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 { | 2857 { |
2865 EXPECT_TRUE(succeeded); | 2858 EXPECT_TRUE(succeeded); |
2866 endTest(); | 2859 endTest(); |
2867 } | 2860 } |
2868 | 2861 |
2869 virtual void afterTest() OVERRIDE | 2862 virtual void afterTest() OVERRIDE |
2870 { | 2863 { |
2871 } | 2864 } |
2872 | 2865 |
2873 private: | 2866 private: |
2874 MockContentLayerClient m_client; | 2867 FakeContentLayerClient m_client; |
2875 scoped_refptr<EvictionTestLayer> m_layer; | 2868 scoped_refptr<EvictionTestLayer> m_layer; |
2876 LayerTreeHostImpl* m_implForEvictTextures; | 2869 LayerTreeHostImpl* m_implForEvictTextures; |
2877 int m_numCommits; | 2870 int m_numCommits; |
2878 }; | 2871 }; |
2879 | 2872 |
2880 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLostContextAfterEvictTextures) | 2873 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLostContextAfterEvictTextures) |
2881 | 2874 |
2882 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public
WebKit::CompositorFakeWebGraphicsContext3D { | 2875 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public
WebKit::CompositorFakeWebGraphicsContext3D { |
2883 public: | 2876 public: |
2884 static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC
ontext> create(Attributes attrs) | 2877 static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC
ontext> create(Attributes attrs) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2953 m_parent->setNeedsDisplay(); | 2946 m_parent->setNeedsDisplay(); |
2954 for (int i = 0; i < m_numChildren; i++) | 2947 for (int i = 0; i < m_numChildren; i++) |
2955 m_children[i]->setNeedsDisplay(); | 2948 m_children[i]->setNeedsDisplay(); |
2956 } | 2949 } |
2957 | 2950 |
2958 virtual void afterTest() | 2951 virtual void afterTest() |
2959 { | 2952 { |
2960 } | 2953 } |
2961 | 2954 |
2962 private: | 2955 private: |
2963 MockContentLayerClient m_client; | 2956 FakeContentLayerClient m_client; |
2964 scoped_refptr<ContentLayerWithUpdateTracking> m_parent; | 2957 scoped_refptr<ContentLayerWithUpdateTracking> m_parent; |
2965 int m_numChildren; | 2958 int m_numChildren; |
2966 std::vector<scoped_refptr<ContentLayerWithUpdateTracking> > m_children; | 2959 std::vector<scoped_refptr<ContentLayerWithUpdateTracking> > m_children; |
2967 }; | 2960 }; |
2968 | 2961 |
2969 TEST_F(LayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread) | 2962 TEST_F(LayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread) |
2970 { | 2963 { |
2971 runTest(true); | 2964 runTest(true); |
2972 } | 2965 } |
2973 | 2966 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3027 : m_numCommitComplete(0) | 3020 : m_numCommitComplete(0) |
3028 , m_numDrawLayers(0) | 3021 , m_numDrawLayers(0) |
3029 { | 3022 { |
3030 } | 3023 } |
3031 | 3024 |
3032 virtual void beginTest() OVERRIDE | 3025 virtual void beginTest() OVERRIDE |
3033 { | 3026 { |
3034 m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 3027 m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
3035 m_layerTreeHost->rootLayer()->setBounds(gfx::Size(10, 10)); | 3028 m_layerTreeHost->rootLayer()->setBounds(gfx::Size(10, 10)); |
3036 | 3029 |
3037 m_contentLayer = ContentLayer::create(&m_mockDelegate); | 3030 m_contentLayer = ContentLayer::create(&m_fakeDelegate); |
3038 m_contentLayer->setBounds(gfx::Size(10, 10)); | 3031 m_contentLayer->setBounds(gfx::Size(10, 10)); |
3039 m_contentLayer->setPosition(gfx::PointF(0, 0)); | 3032 m_contentLayer->setPosition(gfx::PointF(0, 0)); |
3040 m_contentLayer->setAnchorPoint(gfx::PointF(0, 0)); | 3033 m_contentLayer->setAnchorPoint(gfx::PointF(0, 0)); |
3041 m_contentLayer->setIsDrawable(true); | 3034 m_contentLayer->setIsDrawable(true); |
3042 m_layerTreeHost->rootLayer()->addChild(m_contentLayer); | 3035 m_layerTreeHost->rootLayer()->addChild(m_contentLayer); |
3043 | 3036 |
3044 postSetNeedsCommitToMainThread(); | 3037 postSetNeedsCommitToMainThread(); |
3045 } | 3038 } |
3046 | 3039 |
3047 virtual void didCommit() OVERRIDE | 3040 virtual void didCommit() OVERRIDE |
(...skipping 17 matching lines...) Expand all Loading... |
3065 virtual void afterTest() OVERRIDE | 3058 virtual void afterTest() OVERRIDE |
3066 { | 3059 { |
3067 // Check that we didn't commit twice between first and second draw. | 3060 // Check that we didn't commit twice between first and second draw. |
3068 EXPECT_EQ(1, m_numCommitComplete); | 3061 EXPECT_EQ(1, m_numCommitComplete); |
3069 | 3062 |
3070 // Clear layer references so LayerTreeHost dies. | 3063 // Clear layer references so LayerTreeHost dies. |
3071 m_contentLayer = NULL; | 3064 m_contentLayer = NULL; |
3072 } | 3065 } |
3073 | 3066 |
3074 private: | 3067 private: |
3075 MockContentLayerClient m_mockDelegate; | 3068 FakeContentLayerClient m_fakeDelegate; |
3076 scoped_refptr<Layer> m_contentLayer; | 3069 scoped_refptr<Layer> m_contentLayer; |
3077 int m_numCommitComplete; | 3070 int m_numCommitComplete; |
3078 int m_numDrawLayers; | 3071 int m_numDrawLayers; |
3079 }; | 3072 }; |
3080 | 3073 |
3081 TEST_F(LayerTreeHostTestContinuousInvalidate, runMultiThread) | 3074 TEST_F(LayerTreeHostTestContinuousInvalidate, runMultiThread) |
3082 { | 3075 { |
3083 runTest(true); | 3076 runTest(true); |
3084 } | 3077 } |
3085 | 3078 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 int m_numCommitsDeferred; | 3218 int m_numCommitsDeferred; |
3226 int m_numCompleteCommits; | 3219 int m_numCompleteCommits; |
3227 }; | 3220 }; |
3228 | 3221 |
3229 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) | 3222 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) |
3230 { | 3223 { |
3231 runTest(true); | 3224 runTest(true); |
3232 } | 3225 } |
3233 | 3226 |
3234 } // anonymous namespace | 3227 } // anonymous namespace |
OLD | NEW |