| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/canvas_skia.h" | 9 #include "ui/gfx/canvas_skia.h" |
| 10 #include "ui/gfx/compositor/compositor_observer.h" | 10 #include "ui/gfx/compositor/compositor_observer.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 | 860 |
| 861 NullLayerDelegate delegate; | 861 NullLayerDelegate delegate; |
| 862 l1->set_delegate(&delegate); | 862 l1->set_delegate(&delegate); |
| 863 l2->set_delegate(&delegate); | 863 l2->set_delegate(&delegate); |
| 864 l3->set_delegate(&delegate); | 864 l3->set_delegate(&delegate); |
| 865 | 865 |
| 866 // Layers should initially be drawn. | 866 // Layers should initially be drawn. |
| 867 EXPECT_TRUE(l1->IsDrawn()); | 867 EXPECT_TRUE(l1->IsDrawn()); |
| 868 EXPECT_TRUE(l2->IsDrawn()); | 868 EXPECT_TRUE(l2->IsDrawn()); |
| 869 EXPECT_TRUE(l3->IsDrawn()); | 869 EXPECT_TRUE(l3->IsDrawn()); |
| 870 #if defined(USE_WEBKIT_COMPOSITOR) |
| 871 EXPECT_EQ(1.f, l1->web_layer().opacity()); |
| 872 EXPECT_EQ(1.f, l2->web_layer().opacity()); |
| 873 EXPECT_EQ(1.f, l3->web_layer().opacity()); |
| 874 #endif |
| 870 | 875 |
| 871 compositor()->SetRootLayer(l1.get()); | 876 compositor()->SetRootLayer(l1.get()); |
| 872 | 877 |
| 873 Draw(); | 878 Draw(); |
| 874 | 879 |
| 875 l1->SetVisible(false); | 880 l1->SetVisible(false); |
| 876 EXPECT_FALSE(l1->IsDrawn()); | 881 EXPECT_FALSE(l1->IsDrawn()); |
| 877 EXPECT_FALSE(l2->IsDrawn()); | 882 EXPECT_FALSE(l2->IsDrawn()); |
| 878 EXPECT_FALSE(l3->IsDrawn()); | 883 EXPECT_FALSE(l3->IsDrawn()); |
| 884 #if defined(USE_WEBKIT_COMPOSITOR) |
| 885 EXPECT_EQ(0.f, l1->web_layer().opacity()); |
| 886 #endif |
| 879 | 887 |
| 880 l3->SetVisible(false); | 888 l3->SetVisible(false); |
| 881 EXPECT_FALSE(l1->IsDrawn()); | 889 EXPECT_FALSE(l1->IsDrawn()); |
| 882 EXPECT_FALSE(l2->IsDrawn()); | 890 EXPECT_FALSE(l2->IsDrawn()); |
| 883 EXPECT_FALSE(l3->IsDrawn()); | 891 EXPECT_FALSE(l3->IsDrawn()); |
| 892 #if defined(USE_WEBKIT_COMPOSITOR) |
| 893 EXPECT_EQ(0.f, l3->web_layer().opacity()); |
| 894 #endif |
| 884 | 895 |
| 885 l1->SetVisible(true); | 896 l1->SetVisible(true); |
| 886 EXPECT_TRUE(l1->IsDrawn()); | 897 EXPECT_TRUE(l1->IsDrawn()); |
| 887 EXPECT_TRUE(l2->IsDrawn()); | 898 EXPECT_TRUE(l2->IsDrawn()); |
| 888 EXPECT_FALSE(l3->IsDrawn()); | 899 EXPECT_FALSE(l3->IsDrawn()); |
| 900 #if defined(USE_WEBKIT_COMPOSITOR) |
| 901 EXPECT_EQ(1.f, l1->web_layer().opacity()); |
| 902 #endif |
| 889 } | 903 } |
| 890 | 904 |
| 891 } // namespace ui | 905 } // namespace ui |
| OLD | NEW |