| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/layers/heads_up_display_layer.h" | 5 #include "cc/layers/heads_up_display_layer.h" |
| 6 #include "cc/layers/layer.h" | 6 #include "cc/layers/layer.h" |
| 7 #include "cc/test/layer_tree_test.h" | 7 #include "cc/test/layer_tree_test.h" |
| 8 #include "cc/trees/layer_tree_host.h" | 8 #include "cc/trees/layer_tree_host.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 ASSERT_TRUE(layer_tree_host()->hud_layer()); | 50 ASSERT_TRUE(layer_tree_host()->hud_layer()); |
| 51 | 51 |
| 52 switch (num_commits_) { | 52 switch (num_commits_) { |
| 53 case 1: | 53 case 1: |
| 54 // Change directly to a new root layer. | 54 // Change directly to a new root layer. |
| 55 layer_tree_host()->SetRootLayer(root_layer1_); | 55 layer_tree_host()->SetRootLayer(root_layer1_); |
| 56 break; | 56 break; |
| 57 case 2: | 57 case 2: |
| 58 EXPECT_EQ(root_layer1_.get(), layer_tree_host()->hud_layer()->parent()); | 58 EXPECT_EQ(root_layer1_.get(), layer_tree_host()->hud_layer()->parent()); |
| 59 // Unset the root layer. | 59 // Unset the root layer. |
| 60 layer_tree_host()->SetRootLayer(NULL); | 60 layer_tree_host()->SetRootLayer(nullptr); |
| 61 break; | 61 break; |
| 62 case 3: | 62 case 3: |
| 63 EXPECT_EQ(0, layer_tree_host()->hud_layer()->parent()); | 63 EXPECT_EQ(0, layer_tree_host()->hud_layer()->parent()); |
| 64 // Change back to the previous root layer. | 64 // Change back to the previous root layer. |
| 65 layer_tree_host()->SetRootLayer(root_layer1_); | 65 layer_tree_host()->SetRootLayer(root_layer1_); |
| 66 break; | 66 break; |
| 67 case 4: | 67 case 4: |
| 68 EXPECT_EQ(root_layer1_.get(), layer_tree_host()->hud_layer()->parent()); | 68 EXPECT_EQ(root_layer1_.get(), layer_tree_host()->hud_layer()->parent()); |
| 69 // Unset the root layer. | 69 // Unset the root layer. |
| 70 layer_tree_host()->SetRootLayer(NULL); | 70 layer_tree_host()->SetRootLayer(nullptr); |
| 71 break; | 71 break; |
| 72 case 5: | 72 case 5: |
| 73 EXPECT_EQ(0, layer_tree_host()->hud_layer()->parent()); | 73 EXPECT_EQ(0, layer_tree_host()->hud_layer()->parent()); |
| 74 // Change to a new root layer from a null root. | 74 // Change to a new root layer from a null root. |
| 75 layer_tree_host()->SetRootLayer(root_layer2_); | 75 layer_tree_host()->SetRootLayer(root_layer2_); |
| 76 break; | 76 break; |
| 77 case 6: | 77 case 6: |
| 78 EXPECT_EQ(root_layer2_.get(), layer_tree_host()->hud_layer()->parent()); | 78 EXPECT_EQ(root_layer2_.get(), layer_tree_host()->hud_layer()->parent()); |
| 79 // Change directly back to the last root layer/ | 79 // Change directly back to the last root layer/ |
| 80 layer_tree_host()->SetRootLayer(root_layer1_); | 80 layer_tree_host()->SetRootLayer(root_layer1_); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 91 private: | 91 private: |
| 92 scoped_refptr<DrawsContentLayer> root_layer1_; | 92 scoped_refptr<DrawsContentLayer> root_layer1_; |
| 93 scoped_refptr<DrawsContentLayer> root_layer2_; | 93 scoped_refptr<DrawsContentLayer> root_layer2_; |
| 94 int num_commits_; | 94 int num_commits_; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 MULTI_THREAD_TEST_F(HudWithRootLayerChange); | 97 MULTI_THREAD_TEST_F(HudWithRootLayerChange); |
| 98 | 98 |
| 99 } // namespace | 99 } // namespace |
| 100 } // namespace cc | 100 } // namespace cc |
| OLD | NEW |