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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2443613002: Rename classes related to top controls (Closed)
Patch Set: fix test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_in_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index d73bf72807aa82371b3e37d916cdf2fa5c093a3d..af27876228924cbbdd0dfa0f0348a777875defb4 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -20,10 +20,10 @@
#include "cc/animation/animation_id_provider.h"
#include "cc/animation/transform_operations.h"
#include "cc/base/math_util.h"
+#include "cc/input/browser_controls_offset_manager.h"
#include "cc/input/main_thread_scrolling_reason.h"
#include "cc/input/page_scale_animation.h"
#include "cc/input/scrollbar_animation_controller_thinning.h"
-#include "cc/input/top_controls_manager.h"
#include "cc/layers/append_quads_data.h"
#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/layers/layer_impl.h"
@@ -3904,9 +3904,9 @@ TEST_F(LayerTreeHostImplTest, ClampingAfterActivation) {
EXPECT_EQ(active_outer_layer->CurrentScrollOffset(), gfx::ScrollOffset(0, 0));
}
-class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
+class LayerTreeHostImplBrowserControlsTest : public LayerTreeHostImplTest {
public:
- LayerTreeHostImplTopControlsTest()
+ LayerTreeHostImplBrowserControlsTest()
// Make the clip size the same as the layer (content) size so the layer is
// non-scrollable.
: layer_size_(10, 10),
@@ -3923,33 +3923,33 @@ class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
settings, std::move(compositor_frame_sink));
if (init) {
host_impl_->active_tree()->set_top_controls_height(top_controls_height_);
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(1.f);
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
}
return init;
}
- void SetupTopControlsAndScrollLayerWithVirtualViewport(
+ void SetupBrowserControlsAndScrollLayerWithVirtualViewport(
const gfx::Size& inner_viewport_size,
const gfx::Size& outer_viewport_size,
const gfx::Size& scroll_layer_size) {
settings_ = DefaultSettings();
CreateHostImpl(settings_, CreateCompositorFrameSink());
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
host_impl_->active_tree(), inner_viewport_size, outer_viewport_size,
scroll_layer_size);
}
- void SetupTopControlsAndScrollLayerWithVirtualViewport(
+ void SetupBrowserControlsAndScrollLayerWithVirtualViewport(
LayerTreeImpl* tree_impl,
const gfx::Size& inner_viewport_size,
const gfx::Size& outer_viewport_size,
const gfx::Size& scroll_layer_size) {
- tree_impl->set_top_controls_shrink_blink_size(true);
+ tree_impl->set_browser_controls_shrink_blink_size(true);
tree_impl->set_top_controls_height(top_controls_height_);
- tree_impl->SetCurrentTopControlsShownRatio(1.f);
+ tree_impl->SetCurrentBrowserControlsShownRatio(1.f);
tree_impl->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
- host_impl_->DidChangeTopControlsPosition();
+ host_impl_->DidChangeBrowserControlsPosition();
std::unique_ptr<LayerImpl> root = LayerImpl::Create(tree_impl, 1);
std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(tree_impl, 2);
@@ -4000,16 +4000,16 @@ class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
float top_controls_height_;
LayerTreeSettings settings_;
-}; // class LayerTreeHostImplTopControlsTest
+}; // class LayerTreeHostImplBrowserControlsTest
// Tests that, on a page with content the same size as the viewport, hiding
-// the top controls also increases the ScrollableSize (i.e. the content size).
-// Since the viewport got larger, the effective scrollable "content" also did.
-// This ensures, for one thing, that the overscroll glow is shown in the right
-// place.
-TEST_F(LayerTreeHostImplTopControlsTest,
- HidingTopControlsExpandsScrollableSize) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// the browser controls also increases the ScrollableSize (i.e. the content
+// size). Since the viewport got larger, the effective scrollable "content" also
+// did. This ensures, for one thing, that the overscroll glow is shown in the
+// right place.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ HidingBrowserControlsExpandsScrollableSize) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(50, 50), gfx::Size(50, 50), gfx::Size(50, 50));
LayerTreeImpl* active_tree = host_impl_->active_tree();
@@ -4028,7 +4028,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
LayerImpl* inner_container = active_tree->InnerViewportContainerLayer();
LayerImpl* outer_container = active_tree->OuterViewportContainerLayer();
- // The top controls should start off showing so the viewport should be shrunk.
+ // The browser controls should start off showing so the viewport should be
+ // shrunk.
ASSERT_EQ(gfx::Size(50, 50), inner_container->bounds());
ASSERT_EQ(gfx::Size(50, 50), outer_container->bounds());
@@ -4040,21 +4041,21 @@ TEST_F(LayerTreeHostImplTopControlsTest,
InputHandler::TOUCHSCREEN)
.thread);
- host_impl_->top_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBegin();
- // Hide the top controls by a bit, the scrollable size should increase but the
- // actual content bounds shouldn't.
+ // Hide the browser controls by a bit, the scrollable size should increase but
+ // the actual content bounds shouldn't.
{
- host_impl_->top_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 25.f));
+ host_impl_->browser_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 25.f));
ASSERT_EQ(gfx::Size(50, 75), inner_container->bounds());
ASSERT_EQ(gfx::Size(50, 75), outer_container->bounds());
EXPECT_EQ(gfx::SizeF(50, 75), active_tree->ScrollableSize());
EXPECT_EQ(gfx::SizeF(50, 50), content->BoundsForScrolling());
}
- // Fully hide the top controls.
+ // Fully hide the browser controls.
{
- host_impl_->top_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 25.f));
+ host_impl_->browser_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 25.f));
ASSERT_EQ(gfx::Size(50, 100), inner_container->bounds());
ASSERT_EQ(gfx::Size(50, 100), outer_container->bounds());
EXPECT_EQ(gfx::SizeF(50, 100), active_tree->ScrollableSize());
@@ -4063,19 +4064,20 @@ TEST_F(LayerTreeHostImplTopControlsTest,
// Scrolling additionally shouldn't have any effect.
{
- host_impl_->top_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 25.f));
+ host_impl_->browser_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 25.f));
ASSERT_EQ(gfx::Size(50, 100), inner_container->bounds());
ASSERT_EQ(gfx::Size(50, 100), outer_container->bounds());
EXPECT_EQ(gfx::SizeF(50, 100), active_tree->ScrollableSize());
EXPECT_EQ(gfx::SizeF(50, 50), content->BoundsForScrolling());
}
- host_impl_->top_controls_manager()->ScrollEnd();
+ host_impl_->browser_controls_manager()->ScrollEnd();
host_impl_->ScrollEnd(EndState().get());
}
-TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ ScrollBrowserControlsByFractionalAmount) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(10, 10), gfx::Size(10, 10), gfx::Size(10, 10));
DrawFrame();
@@ -4087,11 +4089,11 @@ TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
// Make the test scroll delta a fractional amount, to verify that the
// fixed container size delta is (1) non-zero, and (2) fractional, and
- // (3) matches the movement of the top controls.
+ // (3) matches the movement of the browser controls.
gfx::Vector2dF top_controls_scroll_delta(0.f, 5.25f);
- host_impl_->top_controls_manager()->ScrollBegin();
- host_impl_->top_controls_manager()->ScrollBy(top_controls_scroll_delta);
- host_impl_->top_controls_manager()->ScrollEnd();
+ host_impl_->browser_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBy(top_controls_scroll_delta);
+ host_impl_->browser_controls_manager()->ScrollEnd();
LayerImpl* inner_viewport_scroll_layer =
host_impl_->active_tree()->InnerViewportScrollLayer();
@@ -4102,11 +4104,12 @@ TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
}
// In this test, the outer viewport is initially unscrollable. We test that a
-// scroll initiated on the inner viewport, causing the top controls to show and
-// thus making the outer viewport scrollable, still scrolls the outer viewport.
-TEST_F(LayerTreeHostImplTopControlsTest,
- TopControlsOuterViewportBecomesScrollable) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// scroll initiated on the inner viewport, causing the browser controls to show
+// and thus making the outer viewport scrollable, still scrolls the outer
+// viewport.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ BrowserControlsOuterViewportBecomesScrollable) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(10, 50), gfx::Size(10, 50), gfx::Size(10, 100));
DrawFrame();
@@ -4133,9 +4136,9 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->ScrollBy(
UpdateState(gfx::Point(), gfx::Vector2dF(0.f, 50.f)).get());
- // The entire scroll delta should have been used to hide the top controls.
+ // The entire scroll delta should have been used to hide the browser controls.
// The viewport layers should be resized back to their full sizes.
- EXPECT_EQ(0.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ EXPECT_EQ(0.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
EXPECT_EQ(0.f, inner_scroll->CurrentScrollOffset().y());
EXPECT_EQ(100.f, inner_container->BoundsForScrolling().height());
EXPECT_EQ(100.f, outer_container->BoundsForScrolling().height());
@@ -4159,10 +4162,10 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->ScrollBy(
UpdateState(gfx::Point(), gfx::Vector2dF(0.f, -50.f)).get());
- // The entire scroll delta should have been used to show the top controls.
+ // The entire scroll delta should have been used to show the browser controls.
// The outer viewport should be resized to accomodate and scrolled to the
// bottom of the document to keep the viewport in place.
- EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
EXPECT_EQ(50.f, outer_container->BoundsForScrolling().height());
EXPECT_EQ(50.f, inner_container->BoundsForScrolling().height());
EXPECT_EQ(25.f, outer_scroll->CurrentScrollOffset().y());
@@ -4189,9 +4192,9 @@ TEST_F(LayerTreeHostImplTopControlsTest,
}
// Test that the fixed position container delta is appropriately adjusted
-// by the top controls showing/hiding and page scale doesn't affect it.
-TEST_F(LayerTreeHostImplTopControlsTest, FixedContainerDelta) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// by the browser controls showing/hiding and page scale doesn't affect it.
+TEST_F(LayerTreeHostImplBrowserControlsTest, FixedContainerDelta) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(100, 100), gfx::Size(100, 100), gfx::Size(100, 100));
DrawFrame();
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f);
@@ -4210,43 +4213,43 @@ TEST_F(LayerTreeHostImplTopControlsTest, FixedContainerDelta) {
InputHandler::TOUCHSCREEN)
.thread);
- // Scroll down, the top controls hiding should expand the viewport size so
+ // Scroll down, the browser controls hiding should expand the viewport size so
// the delta should be equal to the scroll distance.
gfx::Vector2dF top_controls_scroll_delta(0.f, 20.f);
- host_impl_->top_controls_manager()->ScrollBegin();
- host_impl_->top_controls_manager()->ScrollBy(top_controls_scroll_delta);
+ host_impl_->browser_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBy(top_controls_scroll_delta);
EXPECT_FLOAT_EQ(top_controls_height_ - top_controls_scroll_delta.y(),
- host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_FLOAT_EQ(top_controls_scroll_delta.y(),
outer_viewport_scroll_layer->FixedContainerSizeDelta().y());
host_impl_->ScrollEnd(EndState().get());
// Scroll past the maximum extent. The delta shouldn't be greater than the
- // top controls height.
- host_impl_->top_controls_manager()->ScrollBegin();
- host_impl_->top_controls_manager()->ScrollBy(top_controls_scroll_delta);
- host_impl_->top_controls_manager()->ScrollBy(top_controls_scroll_delta);
- host_impl_->top_controls_manager()->ScrollBy(top_controls_scroll_delta);
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ // browser controls height.
+ host_impl_->browser_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBy(top_controls_scroll_delta);
+ host_impl_->browser_controls_manager()->ScrollBy(top_controls_scroll_delta);
+ host_impl_->browser_controls_manager()->ScrollBy(top_controls_scroll_delta);
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, top_controls_height_),
outer_viewport_scroll_layer->FixedContainerSizeDelta());
host_impl_->ScrollEnd(EndState().get());
- // Scroll in the direction to make the top controls show.
- host_impl_->top_controls_manager()->ScrollBegin();
- host_impl_->top_controls_manager()->ScrollBy(-top_controls_scroll_delta);
+ // Scroll in the direction to make the browser controls show.
+ host_impl_->browser_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBy(-top_controls_scroll_delta);
EXPECT_EQ(top_controls_scroll_delta.y(),
- host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(0, top_controls_height_ - top_controls_scroll_delta.y()),
outer_viewport_scroll_layer->FixedContainerSizeDelta());
- host_impl_->top_controls_manager()->ScrollEnd();
+ host_impl_->browser_controls_manager()->ScrollEnd();
}
-// Push a top controls ratio from the main thread that we didn't send as a delta
-// and make sure that the ratio is clamped to the [0, 1] range.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsPushUnsentRatio) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// Push a browser controls ratio from the main thread that we didn't send as a
+// delta and make sure that the ratio is clamped to the [0, 1] range.
+TEST_F(LayerTreeHostImplBrowserControlsTest, BrowserControlsPushUnsentRatio) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(10, 50), gfx::Size(10, 50), gfx::Size(10, 100));
DrawFrame();
@@ -4258,28 +4261,30 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsPushUnsentRatio) {
host_impl_->active_tree()->OuterViewportScrollLayer();
outer_scroll->SetDrawsContent(true);
- host_impl_->active_tree()->PushTopControlsFromMainThread(1);
- ASSERT_EQ(1.0f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ host_impl_->active_tree()->PushBrowserControlsFromMainThread(1);
+ ASSERT_EQ(1.0f,
+ host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.5f);
- ASSERT_EQ(0.5f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(0.5f);
+ ASSERT_EQ(0.5f,
+ host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
- host_impl_->active_tree()->PushTopControlsFromMainThread(0);
+ host_impl_->active_tree()->PushBrowserControlsFromMainThread(0);
- ASSERT_EQ(0, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ ASSERT_EQ(0, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
}
-// Test that if only the top controls are scrolled, we shouldn't request a
+// Test that if only the browser controls are scrolled, we shouldn't request a
// commit.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsDontTriggerCommit) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+TEST_F(LayerTreeHostImplBrowserControlsTest, BrowserControlsDontTriggerCommit) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(100, 50), gfx::Size(100, 100), gfx::Size(100, 100));
DrawFrame();
- // Show top controls
- EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ // Show browser controls
+ EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
- // Scroll 25px to hide top controls
+ // Scroll 25px to hide browser controls
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
host_impl_
@@ -4291,16 +4296,17 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsDontTriggerCommit) {
}
// Test that if a scrollable sublayer doesn't consume the scroll,
-// top controls should hide when scrolling down.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
+// browser controls should hide when scrolling down.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ BrowserControlsScrollableSublayer) {
gfx::Size sub_content_size(100, 400);
gfx::Size sub_content_layer_size(100, 300);
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(100, 50), gfx::Size(100, 100), gfx::Size(100, 100));
DrawFrame();
- // Show top controls
- EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ // Show browser controls
+ EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
LayerImpl* outer_viewport_scroll_layer =
host_impl_->active_tree()->OuterViewportScrollLayer();
@@ -4325,7 +4331,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
std::move(child_clip));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
- // Scroll 25px to hide top controls
+ // Scroll 25px to hide browser controls
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
host_impl_
@@ -4335,37 +4341,41 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
host_impl_->ScrollEnd(EndState().get());
- // Top controls should be hidden
+ // Browser controls should be hidden
EXPECT_EQ(scroll_delta.y(),
top_controls_height_ -
- host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->browser_controls_manager()->ContentTopOffset());
}
-// Ensure setting the top controls position explicitly using the setters on the
-// TreeImpl correctly affects the top controls manager and viewport bounds.
-TEST_F(LayerTreeHostImplTopControlsTest, PositionTopControlsExplicitly) {
+// Ensure setting the browser controls position explicitly using the setters on
+// the TreeImpl correctly affects the browser controls manager and viewport
+// bounds.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ PositionBrowserControlsExplicitly) {
settings_ = DefaultSettings();
CreateHostImpl(settings_, CreateCompositorFrameSink());
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
layer_size_, layer_size_, layer_size_);
DrawFrame();
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.f);
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(0.f);
host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread(
30.f / top_controls_height_);
host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive();
- EXPECT_FLOAT_EQ(30.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_FLOAT_EQ(30.f,
+ host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_FLOAT_EQ(-20.f,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.f);
- EXPECT_FLOAT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(0.f);
+ EXPECT_FLOAT_EQ(0.f,
+ host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_FLOAT_EQ(-50.f,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
- host_impl_->DidChangeTopControlsPosition();
+ host_impl_->DidChangeBrowserControlsPosition();
- // Now that top controls have moved, expect the clip to resize.
+ // Now that browser controls have moved, expect the clip to resize.
LayerImpl* inner_clip_ptr = host_impl_->InnerViewportScrollLayer()
->test_properties()
->parent->test_properties()
@@ -4374,34 +4384,34 @@ TEST_F(LayerTreeHostImplTopControlsTest, PositionTopControlsExplicitly) {
}
// Test that the top_controls delta and sent delta are appropriately
-// applied on sync tree activation. The total top controls offset shouldn't
+// applied on sync tree activation. The total browser controls offset shouldn't
// change after the activation.
-TEST_F(LayerTreeHostImplTopControlsTest, ApplyDeltaOnTreeActivation) {
+TEST_F(LayerTreeHostImplBrowserControlsTest, ApplyDeltaOnTreeActivation) {
settings_ = DefaultSettings();
CreateHostImpl(settings_, CreateCompositorFrameSink());
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
layer_size_, layer_size_, layer_size_);
DrawFrame();
host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread(
20.f / top_controls_height_);
host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive();
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(
15.f / top_controls_height_);
host_impl_->active_tree()
->top_controls_shown_ratio()
->PullDeltaForMainThread();
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.f);
- host_impl_->sync_tree()->PushTopControlsFromMainThread(15.f /
- top_controls_height_);
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(0.f);
+ host_impl_->sync_tree()->PushBrowserControlsFromMainThread(
+ 15.f / top_controls_height_);
- host_impl_->DidChangeTopControlsPosition();
+ host_impl_->DidChangeBrowserControlsPosition();
LayerImpl* inner_clip_ptr = host_impl_->InnerViewportScrollLayer()
->test_properties()
->parent->test_properties()
->parent;
EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds());
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ContentTopOffset());
host_impl_->ActivateSyncTree();
@@ -4409,7 +4419,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, ApplyDeltaOnTreeActivation) {
->test_properties()
->parent->test_properties()
->parent;
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds());
EXPECT_FLOAT_EQ(
@@ -4421,32 +4431,33 @@ TEST_F(LayerTreeHostImplTopControlsTest, ApplyDeltaOnTreeActivation) {
top_controls_height_);
}
-// Test that changing the top controls layout height is correctly applied to
-// the inner viewport container bounds. That is, the top controls layout
+// Test that changing the browser controls layout height is correctly applied to
+// the inner viewport container bounds. That is, the browser controls layout
// height is the amount that the inner viewport container was shrunk outside
-// the compositor to accommodate the top controls.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsLayoutHeightChanged) {
+// the compositor to accommodate the browser controls.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ BrowserControlsLayoutHeightChanged) {
settings_ = DefaultSettings();
CreateHostImpl(settings_, CreateCompositorFrameSink());
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
layer_size_, layer_size_, layer_size_);
DrawFrame();
- host_impl_->sync_tree()->PushTopControlsFromMainThread(1.f);
- host_impl_->sync_tree()->set_top_controls_shrink_blink_size(true);
+ host_impl_->sync_tree()->PushBrowserControlsFromMainThread(1.f);
+ host_impl_->sync_tree()->set_browser_controls_shrink_blink_size(true);
host_impl_->active_tree()->top_controls_shown_ratio()->PushFromMainThread(
1.f);
host_impl_->active_tree()->top_controls_shown_ratio()->PushPendingToActive();
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(0.f);
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(0.f);
- host_impl_->DidChangeTopControlsPosition();
+ host_impl_->DidChangeBrowserControlsPosition();
LayerImpl* inner_clip_ptr = host_impl_->InnerViewportScrollLayer()
->test_properties()
->parent->test_properties()
->parent;
EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds());
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ContentTopOffset());
host_impl_->sync_tree()->root_layer_for_testing()->SetBounds(
gfx::Size(inner_clip_ptr->bounds().width(),
@@ -4458,34 +4469,36 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsLayoutHeightChanged) {
->test_properties()
->parent->test_properties()
->parent;
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ContentTopOffset());
// The total bounds should remain unchanged since the bounds delta should
// account for the difference between the layout height and the current
- // top controls offset.
+ // browser controls offset.
EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0.f, 50.f), inner_clip_ptr->bounds_delta());
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
- host_impl_->DidChangeTopControlsPosition();
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(1.f);
+ host_impl_->DidChangeBrowserControlsPosition();
- EXPECT_EQ(1.f, host_impl_->top_controls_manager()->TopControlsShownRatio());
- EXPECT_EQ(50.f, host_impl_->top_controls_manager()->TopControlsHeight());
- EXPECT_EQ(50.f, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_EQ(1.f,
+ host_impl_->browser_controls_manager()->TopControlsShownRatio());
+ EXPECT_EQ(50.f, host_impl_->browser_controls_manager()->TopControlsHeight());
+ EXPECT_EQ(50.f, host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0.f, 0.f), inner_clip_ptr->bounds_delta());
EXPECT_EQ(gfx::Size(viewport_size_.width(), viewport_size_.height() - 50.f),
inner_clip_ptr->bounds());
}
-// Test that showing/hiding the top controls when the viewport is fully scrolled
-// doesn't incorrectly change the viewport offset due to clamping from changing
-// viewport bounds.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// Test that showing/hiding the browser controls when the viewport is fully
+// scrolled doesn't incorrectly change the viewport offset due to clamping from
+// changing viewport bounds.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ BrowserControlsViewportOffsetClamping) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400));
DrawFrame();
- EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer();
LayerImpl* inner_scroll = host_impl_->InnerViewportScrollLayer();
@@ -4498,7 +4511,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
host_impl_->active_tree()->TotalScrollOffset();
EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), viewport_offset);
- // Hide the top controls by 25px.
+ // Hide the browser controls by 25px.
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
host_impl_
@@ -4507,16 +4520,17 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
.thread);
host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
- // scrolling down at the max extents no longer hides the top controls
- EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ // scrolling down at the max extents no longer hides the browser controls
+ EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
- // forcefully hide the top controls by 25px
- host_impl_->top_controls_manager()->ScrollBy(scroll_delta);
+ // forcefully hide the browser controls by 25px
+ host_impl_->browser_controls_manager()->ScrollBy(scroll_delta);
host_impl_->ScrollEnd(EndState().get());
- EXPECT_FLOAT_EQ(scroll_delta.y(),
- top_controls_height_ -
- host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_FLOAT_EQ(
+ scroll_delta.y(),
+ top_controls_height_ -
+ host_impl_->browser_controls_manager()->ContentTopOffset());
inner_scroll->ClampScrollToMaxScrollOffset();
outer_scroll->ClampScrollToMaxScrollOffset();
@@ -4527,7 +4541,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
viewport_offset = host_impl_->active_tree()->TotalScrollOffset();
- // Bring the top controls down by 25px.
+ // Bring the browser controls down by 25px.
scroll_delta = gfx::Vector2dF(0.f, -25.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
host_impl_
@@ -4548,16 +4562,16 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
host_impl_->active_tree()->TotalScrollOffset());
}
-// Test that the top controls coming in and out maintains the same aspect ratio
-// between the inner and outer viewports.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// Test that the browser controls coming in and out maintains the same aspect
+// ratio between the inner and outer viewports.
+TEST_F(LayerTreeHostImplBrowserControlsTest, BrowserControlsAspectRatio) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400));
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 2.f);
DrawFrame();
EXPECT_FLOAT_EQ(top_controls_height_,
- host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->browser_controls_manager()->ContentTopOffset());
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
@@ -4568,12 +4582,13 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) {
host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
host_impl_->ScrollEnd(EndState().get());
- EXPECT_FLOAT_EQ(scroll_delta.y(),
- top_controls_height_ -
- host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_FLOAT_EQ(
+ scroll_delta.y(),
+ top_controls_height_ -
+ host_impl_->browser_controls_manager()->ContentTopOffset());
- // Top controls were hidden by 25px so the inner viewport should have expanded
- // by that much.
+ // Browser controls were hidden by 25px so the inner viewport should have
+ // expanded by that much.
LayerImpl* outer_container =
host_impl_->active_tree()->OuterViewportContainerLayer();
LayerImpl* inner_container =
@@ -4591,17 +4606,18 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) {
host_impl_->InnerViewportScrollLayer()->BoundsForScrolling());
}
-// Test that scrolling the outer viewport affects the top controls.
-TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+// Test that scrolling the outer viewport affects the browser controls.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ BrowserControlsScrollOuterViewport) {
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400));
DrawFrame();
EXPECT_EQ(top_controls_height_,
- host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->browser_controls_manager()->ContentTopOffset());
// Send a gesture scroll that will scroll the outer viewport, make sure the
- // top controls get scrolled.
+ // browser controls get scrolled.
gfx::Vector2dF scroll_delta(0.f, 15.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
host_impl_
@@ -4614,9 +4630,10 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
host_impl_->CurrentlyScrollingLayer());
host_impl_->ScrollEnd(EndState().get());
- EXPECT_FLOAT_EQ(scroll_delta.y(),
- top_controls_height_ -
- host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_FLOAT_EQ(
+ scroll_delta.y(),
+ top_controls_height_ -
+ host_impl_->browser_controls_manager()->ContentTopOffset());
scroll_delta = gfx::Vector2dF(0.f, 50.f);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
@@ -4626,7 +4643,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
.thread);
host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_EQ(host_impl_->OuterViewportScrollLayer(),
host_impl_->CurrentlyScrollingLayer());
@@ -4648,7 +4665,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(top_controls_height_,
- host_impl_->top_controls_manager()->ContentTopOffset());
+ host_impl_->browser_controls_manager()->ContentTopOffset());
EXPECT_FLOAT_EQ(
inner_viewport_offset.y() + (scroll_delta.y() + top_controls_height_),
ScrollDelta(host_impl_->InnerViewportScrollLayer()).y());
@@ -4656,11 +4673,11 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
host_impl_->ScrollEnd(EndState().get());
}
-TEST_F(LayerTreeHostImplTopControlsTest,
- ScrollNonScrollableRootWithTopControls) {
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ ScrollNonScrollableRootWithBrowserControls) {
settings_ = DefaultSettings();
CreateHostImpl(settings_, CreateCompositorFrameSink());
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
layer_size_, layer_size_, layer_size_);
DrawFrame();
@@ -4670,11 +4687,11 @@ TEST_F(LayerTreeHostImplTopControlsTest,
InputHandler::TOUCHSCREEN)
.thread);
- host_impl_->top_controls_manager()->ScrollBegin();
- host_impl_->top_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 50.f));
- host_impl_->top_controls_manager()->ScrollEnd();
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
- // Now that top controls have moved, expect the clip to resize.
+ host_impl_->browser_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 50.f));
+ host_impl_->browser_controls_manager()->ScrollEnd();
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ContentTopOffset());
+ // Now that browser controls have moved, expect the clip to resize.
LayerImpl* inner_clip_ptr = host_impl_->InnerViewportScrollLayer()
->test_properties()
->parent->test_properties()
@@ -4690,22 +4707,22 @@ TEST_F(LayerTreeHostImplTopControlsTest,
.thread);
float scroll_increment_y = -25.f;
- host_impl_->top_controls_manager()->ScrollBegin();
- host_impl_->top_controls_manager()->ScrollBy(
+ host_impl_->browser_controls_manager()->ScrollBegin();
+ host_impl_->browser_controls_manager()->ScrollBy(
gfx::Vector2dF(0.f, scroll_increment_y));
EXPECT_FLOAT_EQ(-scroll_increment_y,
- host_impl_->top_controls_manager()->ContentTopOffset());
- // Now that top controls have moved, expect the clip to resize.
+ host_impl_->browser_controls_manager()->ContentTopOffset());
+ // Now that browser controls have moved, expect the clip to resize.
EXPECT_EQ(gfx::Size(viewport_size_.width(),
viewport_size_.height() + scroll_increment_y),
inner_clip_ptr->bounds());
- host_impl_->top_controls_manager()->ScrollBy(
+ host_impl_->browser_controls_manager()->ScrollBy(
gfx::Vector2dF(0.f, scroll_increment_y));
- host_impl_->top_controls_manager()->ScrollEnd();
+ host_impl_->browser_controls_manager()->ScrollEnd();
EXPECT_FLOAT_EQ(-2 * scroll_increment_y,
- host_impl_->top_controls_manager()->ContentTopOffset());
- // Now that top controls have moved, expect the clip to resize.
+ host_impl_->browser_controls_manager()->ContentTopOffset());
+ // Now that browser controls have moved, expect the clip to resize.
EXPECT_EQ(clip_size_, inner_clip_ptr->bounds());
host_impl_->ScrollEnd(EndState().get());
@@ -4723,29 +4740,31 @@ TEST_F(LayerTreeHostImplTopControlsTest,
}
// Tests that activating a pending tree while there's a bounds_delta on the
-// viewport layers from top controls doesn't cause a scroll jump. This bug was
-// occurring because the UpdateViewportContainerSizes was being called before
-// the property trees were updated with the bounds_delta. crbug.com/597266.
-TEST_F(LayerTreeHostImplTopControlsTest, ViewportBoundsDeltaOnTreeActivation) {
+// viewport layers from browser controls doesn't cause a scroll jump. This bug
+// was occurring because the UpdateViewportContainerSizes was being called
+// before the property trees were updated with the bounds_delta.
+// crbug.com/597266.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ ViewportBoundsDeltaOnTreeActivation) {
const gfx::Size inner_viewport_size(1000, 1000);
const gfx::Size outer_viewport_size(1000, 1000);
const gfx::Size content_size(2000, 2000);
// Initialization
{
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
inner_viewport_size, outer_viewport_size, content_size);
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
- // Start off with the top controls hidden on both main and impl.
- host_impl_->active_tree()->set_top_controls_shrink_blink_size(false);
- host_impl_->active_tree()->PushTopControlsFromMainThread(0);
+ // Start off with the browser controls hidden on both main and impl.
+ host_impl_->active_tree()->set_browser_controls_shrink_blink_size(false);
+ host_impl_->active_tree()->PushBrowserControlsFromMainThread(0);
host_impl_->CreatePendingTree();
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
host_impl_->pending_tree(), inner_viewport_size, outer_viewport_size,
content_size);
- host_impl_->pending_tree()->set_top_controls_shrink_blink_size(false);
+ host_impl_->pending_tree()->set_browser_controls_shrink_blink_size(false);
// Fully scroll the viewport.
host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(),
@@ -4758,17 +4777,19 @@ TEST_F(LayerTreeHostImplTopControlsTest, ViewportBoundsDeltaOnTreeActivation) {
LayerImpl* outer_scroll =
host_impl_->active_tree()->OuterViewportScrollLayer();
- ASSERT_FLOAT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset());
+ ASSERT_FLOAT_EQ(0,
+ host_impl_->browser_controls_manager()->ContentTopOffset());
ASSERT_EQ(1000, outer_scroll->MaxScrollOffset().y());
ASSERT_EQ(1000, outer_scroll->CurrentScrollOffset().y());
- // Kick off an animation to show the top controls.
- host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, true);
+ // Kick off an animation to show the browser controls.
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
+ BOTH, SHOWN, true);
base::TimeTicks start_time = base::TimeTicks::Now();
BeginFrameArgs begin_frame_args =
CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
- // Pump an animation frame to put some delta in the top controls.
+ // Pump an animation frame to put some delta in the browser controls.
{
begin_frame_args.frame_time =
start_time + base::TimeDelta::FromMilliseconds(50);
@@ -4778,8 +4799,9 @@ TEST_F(LayerTreeHostImplTopControlsTest, ViewportBoundsDeltaOnTreeActivation) {
host_impl_->DidFinishImplFrame();
}
- // Pull the top controls delta and get it back to the pending tree so that
- // when we go to activate the pending tree we cause a change to top controls.
+ // Pull the browser controls delta and get it back to the pending tree so that
+ // when we go to activate the pending tree we cause a change to browser
+ // controls.
{
float delta =
host_impl_->active_tree()->top_controls_shown_ratio()->Delta();
@@ -4792,8 +4814,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, ViewportBoundsDeltaOnTreeActivation) {
delta);
}
- // 200 is the kShowHideMaxDurationMs value from top_controls_manager.cc so the
- // top controls should be fully animated in this frame.
+ // 200 is the kShowHideMaxDurationMs value from browser_controls_manager.cc so
+ // the browser controls should be fully animated in this frame.
{
begin_frame_args.frame_time =
start_time + base::TimeDelta::FromMilliseconds(200);
@@ -4802,7 +4824,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, ViewportBoundsDeltaOnTreeActivation) {
host_impl_->UpdateAnimationState(true);
host_impl_->DidFinishImplFrame();
- ASSERT_EQ(50, host_impl_->top_controls_manager()->ContentTopOffset());
+ ASSERT_EQ(50, host_impl_->browser_controls_manager()->ContentTopOffset());
ASSERT_EQ(1050, outer_scroll->MaxScrollOffset().y());
// NEAR because clip layer bounds are truncated in MaxScrollOffset so we
// lose some precision in the intermediate animation steps.
@@ -8887,23 +8909,23 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
}
}
-class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest {
+class LayerTreeHostImplWithBrowserControlsTest : public LayerTreeHostImplTest {
public:
void SetUp() override {
LayerTreeSettings settings = DefaultSettings();
CreateHostImpl(settings, CreateCompositorFrameSink());
host_impl_->active_tree()->set_top_controls_height(top_controls_height_);
host_impl_->sync_tree()->set_top_controls_height(top_controls_height_);
- host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
+ host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(1.f);
}
protected:
static const int top_controls_height_;
};
-const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50;
+const int LayerTreeHostImplWithBrowserControlsTest::top_controls_height_ = 50;
-TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest, NoIdleAnimations) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
scroll_layer->layer_tree_impl()
->property_trees()
@@ -8917,49 +8939,52 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) {
host_impl_->DidFinishImplFrame();
}
-TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsHeightIsCommitted) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsHeightIsCommitted) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
EXPECT_FALSE(did_request_redraw_);
host_impl_->CreatePendingTree();
host_impl_->sync_tree()->set_top_controls_height(100);
host_impl_->ActivateSyncTree();
- EXPECT_EQ(100, host_impl_->top_controls_manager()->TopControlsHeight());
+ EXPECT_EQ(100, host_impl_->browser_controls_manager()->TopControlsHeight());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest,
- TopControlsStayFullyVisibleOnHeightChange) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsStayFullyVisibleOnHeightChange) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ControlsTopOffset());
host_impl_->CreatePendingTree();
host_impl_->sync_tree()->set_top_controls_height(0);
host_impl_->ActivateSyncTree();
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ControlsTopOffset());
host_impl_->CreatePendingTree();
host_impl_->sync_tree()->set_top_controls_height(50);
host_impl_->ActivateSyncTree();
- EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0.f, host_impl_->browser_controls_manager()->ControlsTopOffset());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationScheduling) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsAnimationScheduling) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
scroll_layer->layer_tree_impl()
->property_trees()
->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(),
gfx::ScrollOffset(0, 10));
- host_impl_->DidChangeTopControlsPosition();
+ host_impl_->DidChangeBrowserControlsPosition();
EXPECT_TRUE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
}
-TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ ScrollHandledByBrowserControls) {
InputHandlerScrollResult result;
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->SetViewportSize(gfx::Size(100, 100));
- host_impl_->top_controls_manager()->UpdateTopControlsState(
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
BOTH, SHOWN, false);
DrawFrame();
@@ -8968,11 +8993,11 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::TOUCHSCREEN)
.thread);
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- // Scroll just the top controls and verify that the scroll succeeds.
+ // Scroll just the browser controls and verify that the scroll succeeds.
const float residue = 10;
float offset = top_controls_height_ - residue;
result = host_impl_->ScrollBy(
@@ -8980,7 +9005,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_TRUE(result.did_scroll);
EXPECT_FLOAT_EQ(-offset,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -8992,7 +9017,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
EXPECT_TRUE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_EQ(-top_controls_height_,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, content_scroll).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -9003,17 +9028,17 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
EXPECT_TRUE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_EQ(-top_controls_height_,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- // And scroll the top controls completely into view
+ // And scroll the browser controls completely into view
offset = -top_controls_height_;
result = host_impl_->ScrollBy(
UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_TRUE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -9022,19 +9047,20 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_FALSE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, -50));
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
host_impl_->ScrollEnd(EndState().get());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest, WheelUnhandledByTopControls) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ WheelUnhandledByBrowserControls) {
SetupScrollAndContentsLayers(gfx::Size(100, 200));
host_impl_->SetViewportSize(gfx::Size(50, 100));
- host_impl_->active_tree()->set_top_controls_shrink_blink_size(true);
- host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN,
- false);
+ host_impl_->active_tree()->set_browser_controls_shrink_blink_size(true);
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
+ BOTH, SHOWN, false);
DrawFrame();
LayerImpl* viewport_layer = host_impl_->InnerViewportScrollLayer();
@@ -9043,17 +9069,18 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, WheelUnhandledByTopControls) {
host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::WHEEL)
.thread);
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(), viewport_layer->CurrentScrollOffset());
- // Wheel scrolls should not affect the top controls, and should pass
+ // Wheel scrolls should not affect the browser controls, and should pass
// directly through to the viewport.
const float delta = top_controls_height_;
EXPECT_TRUE(
host_impl_->ScrollBy(
UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
.did_scroll);
- EXPECT_FLOAT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_FLOAT_EQ(0,
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, delta),
viewport_layer->CurrentScrollOffset());
@@ -9061,17 +9088,19 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, WheelUnhandledByTopControls) {
host_impl_->ScrollBy(
UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
.did_scroll);
- EXPECT_FLOAT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_FLOAT_EQ(0,
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, delta * 2),
viewport_layer->CurrentScrollOffset());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsAnimationAtOrigin) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->SetViewportSize(gfx::Size(100, 200));
- host_impl_->top_controls_manager()->UpdateTopControlsState(
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
BOTH, SHOWN, false);
DrawFrame();
@@ -9080,11 +9109,11 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::TOUCHSCREEN)
.thread);
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- // Scroll the top controls partially.
+ // Scroll the browser controls partially.
const float residue = 35;
float offset = top_controls_height_ - residue;
EXPECT_TRUE(
@@ -9092,7 +9121,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
.did_scroll);
EXPECT_FLOAT_EQ(-offset,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -9102,13 +9131,13 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
// End the scroll while the controls are still offset from their limit.
host_impl_->ScrollEnd(EndState().get());
- ASSERT_TRUE(host_impl_->top_controls_manager()->has_animation());
+ ASSERT_TRUE(host_impl_->browser_controls_manager()->has_animation());
EXPECT_TRUE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
- // The top controls should properly animate until finished, despite the scroll
- // offset being at the origin.
+ // The browser controls should properly animate until finished, despite the
+ // scroll offset being at the origin.
BeginFrameArgs begin_frame_args = CreateBeginFrameArgsForTesting(
BEGINFRAME_FROM_HERE, base::TimeTicks::Now());
while (did_request_next_frame_) {
@@ -9117,7 +9146,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
did_request_commit_ = false;
float old_offset =
- host_impl_->top_controls_manager()->ControlsTopOffset();
+ host_impl_->browser_controls_manager()->ControlsTopOffset();
begin_frame_args.frame_time += base::TimeDelta::FromMilliseconds(5);
host_impl_->WillBeginImplFrame(begin_frame_args);
@@ -9126,7 +9155,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
scroll_layer->CurrentScrollOffset().ToString());
float new_offset =
- host_impl_->top_controls_manager()->ControlsTopOffset();
+ host_impl_->browser_controls_manager()->ControlsTopOffset();
// No commit is needed as the controls are animating the content offset,
// not the scroll offset.
@@ -9136,20 +9165,21 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
EXPECT_TRUE(did_request_redraw_);
if (new_offset != 0) {
- EXPECT_TRUE(host_impl_->top_controls_manager()->has_animation());
+ EXPECT_TRUE(host_impl_->browser_controls_manager()->has_animation());
EXPECT_TRUE(did_request_next_frame_);
}
host_impl_->DidFinishImplFrame();
}
- EXPECT_FALSE(host_impl_->top_controls_manager()->has_animation());
+ EXPECT_FALSE(host_impl_->browser_controls_manager()->has_animation());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsAnimationAfterScroll) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->SetViewportSize(gfx::Size(100, 100));
- host_impl_->top_controls_manager()->UpdateTopControlsState(
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
BOTH, SHOWN, false);
float initial_scroll_offset = 50;
scroll_layer->layer_tree_impl()
@@ -9163,11 +9193,11 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::TOUCHSCREEN)
.thread);
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- // Scroll the top controls partially.
+ // Scroll the browser controls partially.
const float residue = 15;
float offset = top_controls_height_ - residue;
EXPECT_TRUE(
@@ -9175,7 +9205,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
.did_scroll);
EXPECT_FLOAT_EQ(-offset,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -9185,12 +9215,12 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
// End the scroll while the controls are still offset from the limit.
host_impl_->ScrollEnd(EndState().get());
- ASSERT_TRUE(host_impl_->top_controls_manager()->has_animation());
+ ASSERT_TRUE(host_impl_->browser_controls_manager()->has_animation());
EXPECT_TRUE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
- // Animate the top controls to the limit.
+ // Animate the browser controls to the limit.
BeginFrameArgs begin_frame_args = CreateBeginFrameArgsForTesting(
BEGINFRAME_FROM_HERE, base::TimeTicks::Now());
while (did_request_next_frame_) {
@@ -9199,14 +9229,14 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
did_request_commit_ = false;
float old_offset =
- host_impl_->top_controls_manager()->ControlsTopOffset();
+ host_impl_->browser_controls_manager()->ControlsTopOffset();
begin_frame_args.frame_time += base::TimeDelta::FromMilliseconds(5);
host_impl_->WillBeginImplFrame(begin_frame_args);
host_impl_->Animate();
float new_offset =
- host_impl_->top_controls_manager()->ControlsTopOffset();
+ host_impl_->browser_controls_manager()->ControlsTopOffset();
if (new_offset != old_offset) {
EXPECT_TRUE(did_request_redraw_);
@@ -9214,19 +9244,19 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
}
host_impl_->DidFinishImplFrame();
}
- EXPECT_FALSE(host_impl_->top_controls_manager()->has_animation());
+ EXPECT_FALSE(host_impl_->browser_controls_manager()->has_animation());
EXPECT_EQ(-top_controls_height_,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest,
- TopControlsAnimationAfterMainThreadFlingStopped) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsAnimationAfterMainThreadFlingStopped) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->SetViewportSize(gfx::Size(100, 100));
- host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN,
- false);
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
+ BOTH, SHOWN, false);
float initial_scroll_offset = 50;
scroll_layer->layer_tree_impl()
->property_trees()
@@ -9239,11 +9269,11 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::TOUCHSCREEN)
.thread);
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- // Scroll the top controls partially.
+ // Scroll the browser controls partially.
const float residue = 15;
float offset = top_controls_height_ - residue;
EXPECT_TRUE(
@@ -9251,7 +9281,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
.did_scroll);
EXPECT_FLOAT_EQ(-offset,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -9261,12 +9291,12 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
// End the fling while the controls are still offset from the limit.
host_impl_->MainThreadHasStoppedFlinging();
- ASSERT_TRUE(host_impl_->top_controls_manager()->has_animation());
+ ASSERT_TRUE(host_impl_->browser_controls_manager()->has_animation());
EXPECT_TRUE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
- // Animate the top controls to the limit.
+ // Animate the browser controls to the limit.
BeginFrameArgs begin_frame_args = CreateBeginFrameArgsForTesting(
BEGINFRAME_FROM_HERE, base::TimeTicks::Now());
while (did_request_next_frame_) {
@@ -9274,13 +9304,15 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
did_request_next_frame_ = false;
did_request_commit_ = false;
- float old_offset = host_impl_->top_controls_manager()->ControlsTopOffset();
+ float old_offset =
+ host_impl_->browser_controls_manager()->ControlsTopOffset();
begin_frame_args.frame_time += base::TimeDelta::FromMilliseconds(5);
host_impl_->WillBeginImplFrame(begin_frame_args);
host_impl_->Animate();
- float new_offset = host_impl_->top_controls_manager()->ControlsTopOffset();
+ float new_offset =
+ host_impl_->browser_controls_manager()->ControlsTopOffset();
if (new_offset != old_offset) {
EXPECT_TRUE(did_request_redraw_);
@@ -9288,21 +9320,21 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
}
host_impl_->DidFinishImplFrame();
}
- EXPECT_FALSE(host_impl_->top_controls_manager()->has_animation());
+ EXPECT_FALSE(host_impl_->browser_controls_manager()->has_animation());
EXPECT_EQ(-top_controls_height_,
- host_impl_->top_controls_manager()->ControlsTopOffset());
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
}
-TEST_F(LayerTreeHostImplWithTopControlsTest,
- TopControlsScrollDeltaInOverScroll) {
+TEST_F(LayerTreeHostImplWithBrowserControlsTest,
+ BrowserControlsScrollDeltaInOverScroll) {
// Verifies that the overscroll delta should not have accumulated in
- // the top controls if we do a hide and show without releasing finger.
+ // the browser controls if we do a hide and show without releasing finger.
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->SetViewportSize(gfx::Size(100, 100));
- host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN,
- false);
+ host_impl_->browser_controls_manager()->UpdateBrowserControlsState(
+ BOTH, SHOWN, false);
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
@@ -9310,14 +9342,15 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::TOUCHSCREEN)
.thread);
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
float offset = 50;
EXPECT_TRUE(
host_impl_->ScrollBy(
UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
.did_scroll);
- EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(-offset,
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -9356,7 +9389,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
.did_scroll);
EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(-offset,
+ host_impl_->browser_controls_manager()->ControlsTopOffset());
EXPECT_TRUE(
host_impl_->ScrollBy(
@@ -9365,21 +9399,21 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- // Top controls should be fully visible
- EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+ // Browser controls should be fully visible
+ EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
host_impl_->ScrollEnd(EndState().get());
}
// Tests that when we set a child scroller (e.g. a scrolling div) as the outer
-// viewport, scrolling it controls the top controls.
-TEST_F(LayerTreeHostImplTopControlsTest,
- ReplacedOuterViewportScrollsTopControls) {
+// viewport, scrolling it controls the browser controls.
+TEST_F(LayerTreeHostImplBrowserControlsTest,
+ ReplacedOuterViewportScrollsBrowserControls) {
const gfx::Size scroll_content_size(400, 400);
const gfx::Size root_layer_size(200, 200);
const gfx::Size viewport_size(100, 100);
- SetupTopControlsAndScrollLayerWithVirtualViewport(
+ SetupBrowserControlsAndScrollLayerWithVirtualViewport(
viewport_size, viewport_size, root_layer_size);
LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer();
@@ -9411,9 +9445,9 @@ TEST_F(LayerTreeHostImplTopControlsTest,
DrawFrame();
}
- ASSERT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ ASSERT_EQ(1.f, host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
- // Scrolling should scroll the child content and the top controls. The
+ // Scrolling should scroll the child content and the browser controls. The
// original outer viewport should get no scroll.
{
host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
@@ -9425,7 +9459,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
EXPECT_VECTOR_EQ(gfx::Vector2dF(), outer_scroll->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(100.f, 50.f),
scroll_layer->CurrentScrollOffset());
- EXPECT_EQ(0.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
+ EXPECT_EQ(0.f,
+ host_impl_->active_tree()->CurrentBrowserControlsShownRatio());
}
}
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_in_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698