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

Side by Side Diff: cc/input/top_controls_manager_unittest.cc

Issue 2371223002: Keep top controls visible if SHOW is called right after HIDE. (Closed)
Patch Set: 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/input/top_controls_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/top_controls_manager.h" 5 #include "cc/input/top_controls_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 EXPECT_FLOAT_EQ(0.f, manager->BottomControlsShownRatio()); 505 EXPECT_FLOAT_EQ(0.f, manager->BottomControlsShownRatio());
506 manager->ScrollEnd(); 506 manager->ScrollEnd();
507 507
508 manager->ScrollBegin(); 508 manager->ScrollBegin();
509 manager->ScrollBy(gfx::Vector2dF(0.f, -15.f)); 509 manager->ScrollBy(gfx::Vector2dF(0.f, -15.f));
510 EXPECT_FLOAT_EQ(15.f, manager->ContentBottomOffset()); 510 EXPECT_FLOAT_EQ(15.f, manager->ContentBottomOffset());
511 EXPECT_FLOAT_EQ(0.15f, manager->BottomControlsShownRatio()); 511 EXPECT_FLOAT_EQ(0.15f, manager->BottomControlsShownRatio());
512 manager->ScrollEnd(); 512 manager->ScrollEnd();
513 } 513 }
514 514
515 TEST(TopControlsManagerTest, HideAndImmediateShowKeepsControlsVisible) {
516 MockTopControlsManagerClient client(100.f, 0.5f, 0.5f);
517 client.SetBottomControlsHeight(100.f);
518 TopControlsManager* manager = client.manager();
519 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio());
520
521 manager->UpdateTopControlsState(BOTH, HIDDEN, true);
522 EXPECT_TRUE(manager->has_animation());
523 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio());
524
525 manager->UpdateTopControlsState(BOTH, SHOWN, true);
526 EXPECT_FALSE(manager->has_animation());
527 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio());
528 }
529
515 } // namespace 530 } // namespace
516 } // namespace cc 531 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/top_controls_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698