OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 EXPECT_FALSE(layerImpl->hasTileAt(1, 0)); | 791 EXPECT_FALSE(layerImpl->hasTileAt(1, 0)); |
792 EXPECT_FALSE(layerImpl->hasTileAt(1, 1)); | 792 EXPECT_FALSE(layerImpl->hasTileAt(1, 1)); |
793 } | 793 } |
794 | 794 |
795 TEST(TiledLayerChromiumTest, skipsDrawGetsReset) | 795 TEST(TiledLayerChromiumTest, skipsDrawGetsReset) |
796 { | 796 { |
797 // Initialize without threading support. | 797 // Initialize without threading support. |
798 WebKit::WebCompositor::initialize(0); | 798 WebKit::WebCompositor::initialize(0); |
799 FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; | 799 FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; |
800 OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLay
erTreeHostClient, CCLayerTreeSettings()); | 800 OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLay
erTreeHostClient, CCLayerTreeSettings()); |
| 801 ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded()); |
801 | 802 |
802 // Create two 300 x 300 tiled layers. | 803 // Create two 300 x 300 tiled layers. |
803 IntSize contentBounds(300, 300); | 804 IntSize contentBounds(300, 300); |
804 IntRect contentRect(IntPoint::zero(), contentBounds); | 805 IntRect contentRect(IntPoint::zero(), contentBounds); |
805 | 806 |
806 // We have enough memory for only one of the two layers. | 807 // We have enough memory for only one of the two layers. |
807 int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. | 808 int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. |
808 OwnPtr<TextureManager> textureManager = TextureManager::create(memoryLimit,
memoryLimit, memoryLimit); | 809 OwnPtr<TextureManager> textureManager = TextureManager::create(memoryLimit,
memoryLimit, memoryLimit); |
809 | 810 |
810 RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromi
um(textureManager.get())); | 811 RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromi
um(textureManager.get())); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 TEST(TiledLayerChromiumTest, partialUpdates) | 875 TEST(TiledLayerChromiumTest, partialUpdates) |
875 { | 876 { |
876 // Initialize without threading support. | 877 // Initialize without threading support. |
877 WebKit::WebCompositor::initialize(0); | 878 WebKit::WebCompositor::initialize(0); |
878 | 879 |
879 CCLayerTreeSettings settings; | 880 CCLayerTreeSettings settings; |
880 settings.maxPartialTextureUpdates = 4; | 881 settings.maxPartialTextureUpdates = 4; |
881 | 882 |
882 FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; | 883 FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; |
883 OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLay
erTreeHostClient, settings); | 884 OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLay
erTreeHostClient, settings); |
| 885 ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded()); |
884 | 886 |
885 // Create one 500 x 300 tiled layer. | 887 // Create one 500 x 300 tiled layer. |
886 IntSize contentBounds(300, 200); | 888 IntSize contentBounds(300, 200); |
887 IntRect contentRect(IntPoint::zero(), contentBounds); | 889 IntRect contentRect(IntPoint::zero(), contentBounds); |
888 | 890 |
889 OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024,
60*1024*1024, 1024); | 891 OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024,
60*1024*1024, 1024); |
890 RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(t
extureManager.get())); | 892 RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(t
extureManager.get())); |
891 layer->setBounds(contentBounds); | 893 layer->setBounds(contentBounds); |
892 layer->setPosition(FloatPoint(150, 150)); | 894 layer->setPosition(FloatPoint(150, 150)); |
893 layer->invalidateRect(contentRect); | 895 layer->invalidateRect(contentRect); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1372 |
1371 // The middle tile was painted even though not invalidated. | 1373 // The middle tile was painted even though not invalidated. |
1372 EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 30000 + 60 * 210, 1)
; | 1374 EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 30000 + 60 * 210, 1)
; |
1373 // The pixels uploaded will not include the non-invalidated tile in the midd
le. | 1375 // The pixels uploaded will not include the non-invalidated tile in the midd
le. |
1374 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); | 1376 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1375 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 30000 +
1 + 100, 1); | 1377 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 30000 +
1 + 100, 1); |
1376 EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload()); | 1378 EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload()); |
1377 } | 1379 } |
1378 | 1380 |
1379 } // namespace | 1381 } // namespace |
OLD | NEW |