OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <AVFoundation/AVFoundation.h> | 5 #include <AVFoundation/AVFoundation.h> |
6 #include <memory> | 6 #include <memory> |
7 | 7 |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 properties->sorting_context_id, properties->transform, | 67 properties->sorting_context_id, properties->transform, |
68 properties->gl_image.get(), properties->contents_rect, properties->rect, | 68 properties->gl_image.get(), properties->contents_rect, properties->rect, |
69 properties->background_color, properties->edge_aa_mask, | 69 properties->background_color, properties->edge_aa_mask, |
70 properties->opacity, properties->filter)); | 70 properties->opacity, properties->filter)); |
71 } | 71 } |
72 | 72 |
73 void UpdateCALayerTree(std::unique_ptr<ui::CARendererLayerTree>& ca_layer_tree, | 73 void UpdateCALayerTree(std::unique_ptr<ui::CARendererLayerTree>& ca_layer_tree, |
74 CALayerProperties* properties, | 74 CALayerProperties* properties, |
75 CALayer* superlayer) { | 75 CALayer* superlayer) { |
76 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 76 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
77 new ui::CARendererLayerTree); | 77 new ui::CARendererLayerTree(true)); |
78 bool result = ScheduleCALayer(new_ca_layer_tree.get(), properties); | 78 bool result = ScheduleCALayer(new_ca_layer_tree.get(), properties); |
79 EXPECT_TRUE(result); | 79 EXPECT_TRUE(result); |
80 new_ca_layer_tree->CommitScheduledCALayers( | 80 new_ca_layer_tree->CommitScheduledCALayers( |
| 81 superlayer, std::move(ca_layer_tree), properties->scale_factor); |
| 82 std::swap(new_ca_layer_tree, ca_layer_tree); |
| 83 } |
| 84 |
| 85 void UpdateCALayerTreeWithAVDisabled( |
| 86 std::unique_ptr<ui::CARendererLayerTree>& ca_layer_tree, |
| 87 CALayerProperties* properties, |
| 88 CALayer* superlayer) { |
| 89 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
| 90 new ui::CARendererLayerTree(false)); |
| 91 bool result = ScheduleCALayer(new_ca_layer_tree.get(), properties); |
| 92 EXPECT_TRUE(result); |
| 93 new_ca_layer_tree->CommitScheduledCALayers( |
81 superlayer, std::move(ca_layer_tree), properties->scale_factor); | 94 superlayer, std::move(ca_layer_tree), properties->scale_factor); |
82 std::swap(new_ca_layer_tree, ca_layer_tree); | 95 std::swap(new_ca_layer_tree, ca_layer_tree); |
83 } | 96 } |
84 | 97 |
85 } // namespace | 98 } // namespace |
86 | 99 |
87 class CALayerTreeTest : public testing::Test { | 100 class CALayerTreeTest : public testing::Test { |
88 protected: | 101 protected: |
89 void SetUp() override { | 102 void SetUp() override { |
90 superlayer_.reset([[CALayer alloc] init]); | 103 superlayer_.reset([[CALayer alloc] init]); |
(...skipping 20 matching lines...) Expand all Loading... |
111 | 124 |
112 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; | 125 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; |
113 CALayer* root_layer = nil; | 126 CALayer* root_layer = nil; |
114 CALayer* clip_and_sorting_layer = nil; | 127 CALayer* clip_and_sorting_layer = nil; |
115 CALayer* transform_layer = nil; | 128 CALayer* transform_layer = nil; |
116 CALayer* content_layer = nil; | 129 CALayer* content_layer = nil; |
117 | 130 |
118 // Validate the initial values. | 131 // Validate the initial values. |
119 { | 132 { |
120 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 133 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
121 new ui::CARendererLayerTree); | 134 new ui::CARendererLayerTree(true)); |
122 | 135 |
123 UpdateCALayerTree(ca_layer_tree, &properties, superlayer_); | 136 UpdateCALayerTree(ca_layer_tree, &properties, superlayer_); |
124 | 137 |
125 // Validate the tree structure. | 138 // Validate the tree structure. |
126 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 139 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
127 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 140 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
128 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 141 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
129 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 142 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
130 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); | 143 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); |
131 transform_layer = [[clip_and_sorting_layer sublayers] objectAtIndex:0]; | 144 transform_layer = [[clip_and_sorting_layer sublayers] objectAtIndex:0]; |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // * 2 flat and the same (new sorting context layer, 1 transform layer) | 478 // * 2 flat and the same (new sorting context layer, 1 transform layer) |
466 gfx::Transform transforms[5]; | 479 gfx::Transform transforms[5]; |
467 transforms[0].Translate(10, 10); | 480 transforms[0].Translate(10, 10); |
468 transforms[1].RotateAboutZAxis(45.0f); | 481 transforms[1].RotateAboutZAxis(45.0f); |
469 transforms[2].RotateAboutYAxis(45.0f); | 482 transforms[2].RotateAboutYAxis(45.0f); |
470 transforms[3].Translate(10, 10); | 483 transforms[3].Translate(10, 10); |
471 transforms[4].Translate(10, 10); | 484 transforms[4].Translate(10, 10); |
472 | 485 |
473 // Schedule and commit the layers. | 486 // Schedule and commit the layers. |
474 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( | 487 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( |
475 new ui::CARendererLayerTree); | 488 new ui::CARendererLayerTree(true)); |
476 for (size_t i = 0; i < 5; ++i) { | 489 for (size_t i = 0; i < 5; ++i) { |
477 properties.gl_image = gl_images[i]; | 490 properties.gl_image = gl_images[i]; |
478 properties.transform = transforms[i]; | 491 properties.transform = transforms[i]; |
479 bool result = ScheduleCALayer(ca_layer_tree.get(), &properties); | 492 bool result = ScheduleCALayer(ca_layer_tree.get(), &properties); |
480 EXPECT_TRUE(result); | 493 EXPECT_TRUE(result); |
481 } | 494 } |
482 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, | 495 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, |
483 properties.scale_factor); | 496 properties.scale_factor); |
484 | 497 |
485 // Validate the root layer. | 498 // Validate the root layer. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 scoped_refptr<gl::GLImageIOSurface> gl_images[3]; | 561 scoped_refptr<gl::GLImageIOSurface> gl_images[3]; |
549 for (size_t i = 0; i < 3; ++i) { | 562 for (size_t i = 0; i < 3; ++i) { |
550 gl_images[i] = | 563 gl_images[i] = |
551 CreateGLImage(gfx::Size(256, 256), gfx::BufferFormat::BGRA_8888, false); | 564 CreateGLImage(gfx::Size(256, 256), gfx::BufferFormat::BGRA_8888, false); |
552 } | 565 } |
553 | 566 |
554 int sorting_context_ids[3] = {3, -1, 0}; | 567 int sorting_context_ids[3] = {3, -1, 0}; |
555 | 568 |
556 // Schedule and commit the layers. | 569 // Schedule and commit the layers. |
557 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( | 570 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( |
558 new ui::CARendererLayerTree); | 571 new ui::CARendererLayerTree(true)); |
559 for (size_t i = 0; i < 3; ++i) { | 572 for (size_t i = 0; i < 3; ++i) { |
560 properties.sorting_context_id = sorting_context_ids[i]; | 573 properties.sorting_context_id = sorting_context_ids[i]; |
561 properties.gl_image = gl_images[i]; | 574 properties.gl_image = gl_images[i]; |
562 bool result = ScheduleCALayer(ca_layer_tree.get(), &properties); | 575 bool result = ScheduleCALayer(ca_layer_tree.get(), &properties); |
563 EXPECT_TRUE(result); | 576 EXPECT_TRUE(result); |
564 } | 577 } |
565 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, | 578 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, |
566 properties.scale_factor); | 579 properties.scale_factor); |
567 | 580 |
568 // Validate the root layer. | 581 // Validate the root layer. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 625 |
613 // Vary the clipping parameters within sorting contexts. | 626 // Vary the clipping parameters within sorting contexts. |
614 bool is_clippeds[3] = { true, true, false}; | 627 bool is_clippeds[3] = { true, true, false}; |
615 gfx::Rect clip_rects[3] = { | 628 gfx::Rect clip_rects[3] = { |
616 gfx::Rect(0, 0, 16, 16), | 629 gfx::Rect(0, 0, 16, 16), |
617 gfx::Rect(4, 8, 16, 32), | 630 gfx::Rect(4, 8, 16, 32), |
618 gfx::Rect(0, 0, 16, 16) | 631 gfx::Rect(0, 0, 16, 16) |
619 }; | 632 }; |
620 | 633 |
621 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( | 634 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( |
622 new ui::CARendererLayerTree); | 635 new ui::CARendererLayerTree(true)); |
623 // First send the various clip parameters to sorting context zero. This is | 636 // First send the various clip parameters to sorting context zero. This is |
624 // legitimate. | 637 // legitimate. |
625 for (size_t i = 0; i < 3; ++i) { | 638 for (size_t i = 0; i < 3; ++i) { |
626 properties.is_clipped = is_clippeds[i]; | 639 properties.is_clipped = is_clippeds[i]; |
627 properties.clip_rect = clip_rects[i]; | 640 properties.clip_rect = clip_rects[i]; |
628 | 641 |
629 bool result = ScheduleCALayer(ca_layer_tree.get(), &properties); | 642 bool result = ScheduleCALayer(ca_layer_tree.get(), &properties); |
630 EXPECT_TRUE(result); | 643 EXPECT_TRUE(result); |
631 } | 644 } |
632 | 645 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 EXPECT_EQ(1u, [[transform_layer sublayers] count]); | 768 EXPECT_EQ(1u, [[transform_layer sublayers] count]); |
756 content_layer4 = [[transform_layer sublayers] objectAtIndex:0]; | 769 content_layer4 = [[transform_layer sublayers] objectAtIndex:0]; |
757 | 770 |
758 // Validate the content layer. | 771 // Validate the content layer. |
759 EXPECT_FALSE([content_layer4 | 772 EXPECT_FALSE([content_layer4 |
760 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); | 773 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
761 EXPECT_NE(content_layer4, content_layer3); | 774 EXPECT_NE(content_layer4, content_layer3); |
762 } | 775 } |
763 } | 776 } |
764 | 777 |
| 778 // Ensure that blacklisting AVSampleBufferDisplayLayer works. |
| 779 TEST_F(CALayerTreeTest, AVLayerBlacklist) { |
| 780 CALayerProperties properties; |
| 781 properties.gl_image = CreateGLImage( |
| 782 gfx::Size(256, 256), gfx::BufferFormat::YUV_420_BIPLANAR, false); |
| 783 |
| 784 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; |
| 785 CALayer* root_layer = nil; |
| 786 CALayer* clip_and_sorting_layer = nil; |
| 787 CALayer* transform_layer = nil; |
| 788 CALayer* content_layer1 = nil; |
| 789 CALayer* content_layer2 = nil; |
| 790 |
| 791 { |
| 792 UpdateCALayerTree(ca_layer_tree, &properties, superlayer_); |
| 793 |
| 794 // Validate the tree structure. |
| 795 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
| 796 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
| 797 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
| 798 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
| 799 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); |
| 800 transform_layer = [[clip_and_sorting_layer sublayers] objectAtIndex:0]; |
| 801 EXPECT_EQ(1u, [[transform_layer sublayers] count]); |
| 802 content_layer1 = [[transform_layer sublayers] objectAtIndex:0]; |
| 803 |
| 804 // Validate the content layer. |
| 805 EXPECT_TRUE([content_layer1 |
| 806 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
| 807 } |
| 808 |
| 809 { |
| 810 UpdateCALayerTreeWithAVDisabled(ca_layer_tree, &properties, superlayer_); |
| 811 |
| 812 // Validate the tree structure. |
| 813 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
| 814 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
| 815 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
| 816 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
| 817 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); |
| 818 transform_layer = [[clip_and_sorting_layer sublayers] objectAtIndex:0]; |
| 819 EXPECT_EQ(1u, [[transform_layer sublayers] count]); |
| 820 content_layer2 = [[transform_layer sublayers] objectAtIndex:0]; |
| 821 |
| 822 // Validate the content layer. |
| 823 EXPECT_FALSE([content_layer2 |
| 824 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
| 825 EXPECT_NE(content_layer1, content_layer2); |
| 826 } |
| 827 } |
| 828 |
765 // Test fullscreen low power detection. | 829 // Test fullscreen low power detection. |
766 TEST_F(CALayerTreeTest, FullscreenLowPower) { | 830 TEST_F(CALayerTreeTest, FullscreenLowPower) { |
767 CALayerProperties properties; | 831 CALayerProperties properties; |
768 properties.gl_image = CreateGLImage( | 832 properties.gl_image = CreateGLImage( |
769 gfx::Size(256, 256), gfx::BufferFormat::YUV_420_BIPLANAR, true); | 833 gfx::Size(256, 256), gfx::BufferFormat::YUV_420_BIPLANAR, true); |
770 properties.is_clipped = false; | 834 properties.is_clipped = false; |
771 | 835 |
772 CALayerProperties properties_black; | 836 CALayerProperties properties_black; |
773 properties_black.is_clipped = false; | 837 properties_black.is_clipped = false; |
774 properties_black.background_color = SK_ColorBLACK; | 838 properties_black.background_color = SK_ColorBLACK; |
775 CALayerProperties properties_white; | 839 CALayerProperties properties_white; |
776 properties_white.is_clipped = false; | 840 properties_white.is_clipped = false; |
777 properties_white.background_color = SK_ColorWHITE; | 841 properties_white.background_color = SK_ColorWHITE; |
778 | 842 |
779 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; | 843 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; |
780 | 844 |
781 // Test a configuration with no background. | 845 // Test a configuration with no background. |
782 { | 846 { |
783 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 847 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
784 new ui::CARendererLayerTree); | 848 new ui::CARendererLayerTree(true)); |
785 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); | 849 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); |
786 EXPECT_TRUE(result); | 850 EXPECT_TRUE(result); |
787 new_ca_layer_tree->CommitScheduledCALayers( | 851 new_ca_layer_tree->CommitScheduledCALayers( |
788 superlayer_, std::move(ca_layer_tree), properties.scale_factor); | 852 superlayer_, std::move(ca_layer_tree), properties.scale_factor); |
789 bool fullscreen_low_power_valid = | 853 bool fullscreen_low_power_valid = |
790 new_ca_layer_tree->CommitFullscreenLowPowerLayer( | 854 new_ca_layer_tree->CommitFullscreenLowPowerLayer( |
791 fullscreen_low_power_layer_); | 855 fullscreen_low_power_layer_); |
792 std::swap(new_ca_layer_tree, ca_layer_tree); | 856 std::swap(new_ca_layer_tree, ca_layer_tree); |
793 | 857 |
794 // Validate the tree structure. | 858 // Validate the tree structure. |
795 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 859 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
796 CALayer* root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 860 CALayer* root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
797 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 861 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
798 CALayer* clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 862 CALayer* clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
799 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); | 863 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); |
800 CALayer* transform_layer = | 864 CALayer* transform_layer = |
801 [[clip_and_sorting_layer sublayers] objectAtIndex:0]; | 865 [[clip_and_sorting_layer sublayers] objectAtIndex:0]; |
802 EXPECT_EQ(1u, [[transform_layer sublayers] count]); | 866 EXPECT_EQ(1u, [[transform_layer sublayers] count]); |
803 CALayer* content_layer = [[transform_layer sublayers] objectAtIndex:0]; | 867 CALayer* content_layer = [[transform_layer sublayers] objectAtIndex:0]; |
804 | 868 |
805 // Validate the content layer and fullscreen low power mode. | 869 // Validate the content layer and fullscreen low power mode. |
806 EXPECT_TRUE([content_layer | 870 EXPECT_TRUE([content_layer |
807 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); | 871 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
808 EXPECT_TRUE(fullscreen_low_power_valid); | 872 EXPECT_TRUE(fullscreen_low_power_valid); |
809 } | 873 } |
810 | 874 |
811 // Test a configuration with a black background. | 875 // Test a configuration with a black background. |
812 { | 876 { |
813 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 877 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
814 new ui::CARendererLayerTree); | 878 new ui::CARendererLayerTree(true)); |
815 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties_black); | 879 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties_black); |
816 EXPECT_TRUE(result); | 880 EXPECT_TRUE(result); |
817 result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); | 881 result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); |
818 EXPECT_TRUE(result); | 882 EXPECT_TRUE(result); |
819 new_ca_layer_tree->CommitScheduledCALayers( | 883 new_ca_layer_tree->CommitScheduledCALayers( |
820 superlayer_, std::move(ca_layer_tree), properties.scale_factor); | 884 superlayer_, std::move(ca_layer_tree), properties.scale_factor); |
821 bool fullscreen_low_power_valid = | 885 bool fullscreen_low_power_valid = |
822 new_ca_layer_tree->CommitFullscreenLowPowerLayer( | 886 new_ca_layer_tree->CommitFullscreenLowPowerLayer( |
823 fullscreen_low_power_layer_); | 887 fullscreen_low_power_layer_); |
824 std::swap(new_ca_layer_tree, ca_layer_tree); | 888 std::swap(new_ca_layer_tree, ca_layer_tree); |
(...skipping 11 matching lines...) Expand all Loading... |
836 | 900 |
837 // Validate the content layer and fullscreen low power mode. | 901 // Validate the content layer and fullscreen low power mode. |
838 EXPECT_TRUE([content_layer | 902 EXPECT_TRUE([content_layer |
839 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); | 903 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
840 EXPECT_TRUE(fullscreen_low_power_valid); | 904 EXPECT_TRUE(fullscreen_low_power_valid); |
841 } | 905 } |
842 | 906 |
843 // Test a configuration with a white background. It will fail. | 907 // Test a configuration with a white background. It will fail. |
844 { | 908 { |
845 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 909 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
846 new ui::CARendererLayerTree); | 910 new ui::CARendererLayerTree(true)); |
847 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties_white); | 911 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties_white); |
848 EXPECT_TRUE(result); | 912 EXPECT_TRUE(result); |
849 result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); | 913 result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); |
850 EXPECT_TRUE(result); | 914 EXPECT_TRUE(result); |
851 new_ca_layer_tree->CommitScheduledCALayers( | 915 new_ca_layer_tree->CommitScheduledCALayers( |
852 superlayer_, std::move(ca_layer_tree), properties.scale_factor); | 916 superlayer_, std::move(ca_layer_tree), properties.scale_factor); |
853 bool fullscreen_low_power_valid = | 917 bool fullscreen_low_power_valid = |
854 new_ca_layer_tree->CommitFullscreenLowPowerLayer( | 918 new_ca_layer_tree->CommitFullscreenLowPowerLayer( |
855 fullscreen_low_power_layer_); | 919 fullscreen_low_power_layer_); |
856 std::swap(new_ca_layer_tree, ca_layer_tree); | 920 std::swap(new_ca_layer_tree, ca_layer_tree); |
(...skipping 11 matching lines...) Expand all Loading... |
868 | 932 |
869 // Validate the content layer and fullscreen low power mode. | 933 // Validate the content layer and fullscreen low power mode. |
870 EXPECT_TRUE([content_layer | 934 EXPECT_TRUE([content_layer |
871 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); | 935 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
872 EXPECT_FALSE(fullscreen_low_power_valid); | 936 EXPECT_FALSE(fullscreen_low_power_valid); |
873 } | 937 } |
874 | 938 |
875 // Test a configuration with a black foreground. It too will fail. | 939 // Test a configuration with a black foreground. It too will fail. |
876 { | 940 { |
877 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 941 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
878 new ui::CARendererLayerTree); | 942 new ui::CARendererLayerTree(true)); |
879 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); | 943 bool result = ScheduleCALayer(new_ca_layer_tree.get(), &properties); |
880 EXPECT_TRUE(result); | 944 EXPECT_TRUE(result); |
881 result = ScheduleCALayer(new_ca_layer_tree.get(), &properties_black); | 945 result = ScheduleCALayer(new_ca_layer_tree.get(), &properties_black); |
882 EXPECT_TRUE(result); | 946 EXPECT_TRUE(result); |
883 new_ca_layer_tree->CommitScheduledCALayers( | 947 new_ca_layer_tree->CommitScheduledCALayers( |
884 superlayer_, std::move(ca_layer_tree), properties.scale_factor); | 948 superlayer_, std::move(ca_layer_tree), properties.scale_factor); |
885 bool fullscreen_low_power_valid = | 949 bool fullscreen_low_power_valid = |
886 new_ca_layer_tree->CommitFullscreenLowPowerLayer( | 950 new_ca_layer_tree->CommitFullscreenLowPowerLayer( |
887 fullscreen_low_power_layer_); | 951 fullscreen_low_power_layer_); |
888 std::swap(new_ca_layer_tree, ca_layer_tree); | 952 std::swap(new_ca_layer_tree, ca_layer_tree); |
(...skipping 10 matching lines...) Expand all Loading... |
899 CALayer* content_layer = [[transform_layer sublayers] objectAtIndex:0]; | 963 CALayer* content_layer = [[transform_layer sublayers] objectAtIndex:0]; |
900 | 964 |
901 // Validate the content layer and fullscreen low power mode. | 965 // Validate the content layer and fullscreen low power mode. |
902 EXPECT_TRUE([content_layer | 966 EXPECT_TRUE([content_layer |
903 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); | 967 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
904 EXPECT_FALSE(fullscreen_low_power_valid); | 968 EXPECT_FALSE(fullscreen_low_power_valid); |
905 } | 969 } |
906 } | 970 } |
907 | 971 |
908 } // namespace gpu | 972 } // namespace gpu |
OLD | NEW |