Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc |
| index a99f2a91efbbab5c85499499d1ea0360a7751da8..5384cdf2deb1455e00f385b365c5e6b4ba1f64a3 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -1047,10 +1047,12 @@ public: |
| switch (impl->active_tree()->source_frame_number()) { |
| case 0: |
| - // Number of textures should be one for each layer |
| - ASSERT_EQ(2, context->NumTextures()); |
| - // Number of textures used for commit should be one for each layer. |
| - EXPECT_EQ(2, context->NumUsedTextures()); |
| + // Number of textures should be one for each layer plus an auxiliary |
|
danakj
2013/03/21 02:34:42
What if you only create the on-demand texture the
Leandro Graciá Gil
2013/03/21 03:35:50
I think I'll do that. Sounds much simpler.
Leandro Graciá Gil
2013/03/21 16:42:48
Done.
|
| + // texture for on-demand rasterization. |
| + ASSERT_EQ(3, context->NumTextures()); |
| + // Number of textures used for commit should be one for each layer |
| + // plus the auxiliary one on startup. |
| + EXPECT_EQ(3, context->NumUsedTextures()); |
| // Verify that used texture is correct. |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| @@ -1059,17 +1061,19 @@ public: |
| postSetNeedsCommitToMainThread(); |
| break; |
| case 1: |
| - // Number of textures should be doubled as the first textures |
| - // are used by impl thread and cannot by used for update. |
| - ASSERT_EQ(4, context->NumTextures()); |
| + // Number of textures should be doubled (excepting the auxiliary) |
| + // as the first textures are used by impl thread and cannot by used |
| + // for update. |
| + ASSERT_EQ(5, context->NumTextures()); |
| // Number of textures used for commit should still be one for each layer. |
| EXPECT_EQ(2, context->NumUsedTextures()); |
| // First textures should not have been used. |
| - EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| + // Index 0 is used by the auxiliary texture. |
| EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| + EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| // New textures should have been used. |
| - EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| + EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| context->ResetUsedTextures(); |
| postSetNeedsCommitToMainThread(); |
| @@ -1179,10 +1183,12 @@ public: |
| switch (impl->active_tree()->source_frame_number()) { |
| case 0: |
| - // Number of textures should be one for each layer. |
| - ASSERT_EQ(4, context->NumTextures()); |
| - // Number of textures used for commit should be one for each layer. |
| - EXPECT_EQ(4, context->NumUsedTextures()); |
| + // Number of textures should be one for each layer plus an auxiliary |
| + // texture for on-demand rasterization. |
| + ASSERT_EQ(5, context->NumTextures()); |
| + // Number of textures used for commit should be one for each layer |
| + // plus the auxiliary one on startup. |
| + EXPECT_EQ(5, context->NumUsedTextures()); |
| // Verify that used textures are correct. |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| @@ -1193,42 +1199,45 @@ public: |
| postSetNeedsCommitToMainThread(); |
| break; |
| case 1: |
| - // Number of textures should be two for each content layer and one |
| + // Number of textures should be two for each content layer, |
| + // an auxiliary one for on-demand rasterization and one |
| // for each scrollbar, since they always do a partial update. |
| - ASSERT_EQ(6, context->NumTextures()); |
| + ASSERT_EQ(7, context->NumTextures()); |
| // Number of textures used for commit should be one for each content |
| // layer, and one for the scrollbar layer that paints. |
| EXPECT_EQ(3, context->NumUsedTextures()); |
| // First content textures should not have been used. |
| - EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| + // Index 0 is used by the auxiliary texture. |
| EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| - // The non-painting scrollbar's texture wasn't updated. |
| EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| + // The non-painting scrollbar's texture wasn't updated. |
| + EXPECT_FALSE(context->UsedTexture(context->TextureAt(3))); |
| // The painting scrollbar's partial update texture was used. |
| - EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| - // New textures should have been used. |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| + // New textures should have been used. |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(5))); |
| + EXPECT_TRUE(context->UsedTexture(context->TextureAt(6))); |
| context->ResetUsedTextures(); |
| postSetNeedsCommitToMainThread(); |
| break; |
| case 2: |
| - // Number of textures should be two for each content layer and one |
| + // Number of textures should be two for each content layer, |
| + // an auxiliary one for on-demand rasterization and one |
| // for each scrollbar, since they always do a partial update. |
| - ASSERT_EQ(6, context->NumTextures()); |
| + ASSERT_EQ(7, context->NumTextures()); |
| // Number of textures used for commit should be one for each content |
| // layer, and one for the scrollbar layer that paints. |
| EXPECT_EQ(3, context->NumUsedTextures()); |
| // The non-painting scrollbar's texture wasn't updated. |
| - EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| + EXPECT_FALSE(context->UsedTexture(context->TextureAt(3))); |
| // The painting scrollbar does a partial update. |
| - EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| - // One content layer does a partial update also. |
| EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| - EXPECT_FALSE(context->UsedTexture(context->TextureAt(5))); |
| + // One content layer does a partial update also. |
| + EXPECT_TRUE(context->UsedTexture(context->TextureAt(5))); |
| + EXPECT_FALSE(context->UsedTexture(context->TextureAt(6))); |
| context->ResetUsedTextures(); |
| postSetNeedsCommitToMainThread(); |