Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2421913002: Change Aura overlay scrollbars from solid color to painted scrollbars. (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/scrollbar_layer_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 scrollbar->SetScrollLayerId(scroll->id()); 2723 scrollbar->SetScrollLayerId(scroll->id());
2724 root->test_properties()->AddChild(std::move(scrollbar)); 2724 root->test_properties()->AddChild(std::move(scrollbar));
2725 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 2725 host_impl_->active_tree()->BuildPropertyTreesForTesting();
2726 host_impl_->active_tree()->DidBecomeActive(); 2726 host_impl_->active_tree()->DidBecomeActive();
2727 DrawFrame(); 2727 DrawFrame();
2728 } 2728 }
2729 2729
2730 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) { 2730 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) {
2731 LayerTreeSettings settings = DefaultSettings(); 2731 LayerTreeSettings settings = DefaultSettings();
2732 settings.scrollbar_animator = animator; 2732 settings.scrollbar_animator = animator;
2733 settings.scrollbar_fade_delay_ms = 20; 2733 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(20);
2734 settings.scrollbar_fade_duration_ms = 20; 2734 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20);
2735 2735
2736 // If no animator is set, scrollbar won't show and no animation is expected. 2736 // If no animator is set, scrollbar won't show and no animation is expected.
2737 bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR; 2737 bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR;
2738 2738
2739 SetupLayers(settings); 2739 SetupLayers(settings);
2740 2740
2741 base::TimeTicks fake_now = base::TimeTicks::Now(); 2741 base::TimeTicks fake_now = base::TimeTicks::Now();
2742 2742
2743 if (expecting_animations) { 2743 if (expecting_animations) {
2744 // A task will be posted to fade the initial scrollbar. 2744 // A task will be posted to fade the initial scrollbar.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 2916
2917 TEST_F(LayerTreeHostImplTestScrollbarAnimation, NoAnimator) { 2917 TEST_F(LayerTreeHostImplTestScrollbarAnimation, NoAnimator) {
2918 RunTest(LayerTreeSettings::NO_ANIMATOR); 2918 RunTest(LayerTreeSettings::NO_ANIMATOR);
2919 } 2919 }
2920 2920
2921 class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest { 2921 class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
2922 protected: 2922 protected:
2923 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) { 2923 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) {
2924 LayerTreeSettings settings = DefaultSettings(); 2924 LayerTreeSettings settings = DefaultSettings();
2925 settings.scrollbar_animator = animator; 2925 settings.scrollbar_animator = animator;
2926 settings.scrollbar_fade_delay_ms = 20; 2926 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(20);
2927 settings.scrollbar_fade_duration_ms = 20; 2927 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20);
2928 gfx::Size content_size(100, 100); 2928 gfx::Size content_size(100, 100);
2929 2929
2930 // If no animator is set, scrollbar won't show and no animation is expected. 2930 // If no animator is set, scrollbar won't show and no animation is expected.
2931 bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR; 2931 bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR;
2932 2932
2933 CreateHostImpl(settings, CreateCompositorFrameSink()); 2933 CreateHostImpl(settings, CreateCompositorFrameSink());
2934 host_impl_->CreatePendingTree(); 2934 host_impl_->CreatePendingTree();
2935 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); 2935 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size);
2936 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2936 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2937 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400, 2937 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 child->SetBounds(inner_viewport_size); 3047 child->SetBounds(inner_viewport_size);
3048 3048
3049 horiz_scrollbar->SetScrollLayerId(root_scroll->id()); 3049 horiz_scrollbar->SetScrollLayerId(root_scroll->id());
3050 3050
3051 EXPECT_EQ(300, horiz_scrollbar->clip_layer_length()); 3051 EXPECT_EQ(300, horiz_scrollbar->clip_layer_length());
3052 } 3052 }
3053 3053
3054 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) { 3054 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) {
3055 LayerTreeSettings settings = DefaultSettings(); 3055 LayerTreeSettings settings = DefaultSettings();
3056 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; 3056 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
3057 settings.scrollbar_fade_delay_ms = 20; 3057 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(20);
3058 settings.scrollbar_fade_duration_ms = 20; 3058 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20);
3059 CreateHostImpl(settings, CreateCompositorFrameSink()); 3059 CreateHostImpl(settings, CreateCompositorFrameSink());
3060 3060
3061 gfx::Size viewport_size(300, 200); 3061 gfx::Size viewport_size(300, 200);
3062 gfx::Size content_size(1000, 1000); 3062 gfx::Size content_size(1000, 1000);
3063 3063
3064 const int vert_1_id = 10; 3064 const int vert_1_id = 10;
3065 const int horiz_1_id = 11; 3065 const int horiz_1_id = 11;
3066 const int vert_2_id = 12; 3066 const int vert_2_id = 12;
3067 const int horiz_2_id = 13; 3067 const int horiz_2_id = 13;
3068 const int child_clip_id = 14; 3068 const int child_clip_id = 14;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 host_impl_->active_tree()->InnerViewportScrollLayer()->SetCurrentScrollOffset( 3167 host_impl_->active_tree()->InnerViewportScrollLayer()->SetCurrentScrollOffset(
3168 gfx::ScrollOffset(20, 20)); 3168 gfx::ScrollOffset(20, 20));
3169 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 3169 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
3170 child_ptr->SetCurrentScrollOffset(gfx::ScrollOffset(20, 20)); 3170 child_ptr->SetCurrentScrollOffset(gfx::ScrollOffset(20, 20));
3171 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 3171 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
3172 } 3172 }
3173 3173
3174 void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale( 3174 void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
3175 float device_scale_factor) { 3175 float device_scale_factor) {
3176 LayerTreeSettings settings = DefaultSettings(); 3176 LayerTreeSettings settings = DefaultSettings();
3177 settings.scrollbar_fade_delay_ms = 500; 3177 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
3178 settings.scrollbar_fade_duration_ms = 300; 3178 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
3179 settings.scrollbar_animator = LayerTreeSettings::THINNING; 3179 settings.scrollbar_animator = LayerTreeSettings::THINNING;
3180 3180
3181 gfx::Size viewport_size(300, 200); 3181 gfx::Size viewport_size(300, 200);
3182 gfx::Size device_viewport_size = 3182 gfx::Size device_viewport_size =
3183 gfx::ScaleToFlooredSize(viewport_size, device_scale_factor); 3183 gfx::ScaleToFlooredSize(viewport_size, device_scale_factor);
3184 gfx::Size content_size(1000, 1000); 3184 gfx::Size content_size(1000, 1000);
3185 gfx::Size scrollbar_size(gfx::Size(15, viewport_size.height())); 3185 gfx::Size scrollbar_size(gfx::Size(15, viewport_size.height()));
3186 3186
3187 CreateHostImpl(settings, CreateCompositorFrameSink()); 3187 CreateHostImpl(settings, CreateCompositorFrameSink());
3188 host_impl_->active_tree()->SetDeviceScaleFactor(device_scale_factor); 3188 host_impl_->active_tree()->SetDeviceScaleFactor(device_scale_factor);
(...skipping 8214 matching lines...) Expand 10 before | Expand all | Expand 10 after
11403 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11403 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11404 11404
11405 // Re-initialize with a software output surface. 11405 // Re-initialize with a software output surface.
11406 compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware(); 11406 compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware();
11407 host_impl_->InitializeRenderer(compositor_frame_sink_.get()); 11407 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
11408 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11408 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11409 } 11409 }
11410 11410
11411 } // namespace 11411 } // namespace
11412 } // namespace cc 11412 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/scrollbar_layer_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698