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

Unified Diff: ui/views/animation/test/test_ink_drop_host.cc

Issue 2340993002: Tweaks to "Allow InkDropRipple to co-exist with highlight or not exist at all." (Closed)
Patch Set: Fixed InkDropImplTest.HighlightCanExistWithoutRipple. Created 4 years, 3 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
Index: ui/views/animation/test/test_ink_drop_host.cc
diff --git a/ui/views/animation/test/test_ink_drop_host.cc b/ui/views/animation/test/test_ink_drop_host.cc
index 07b17286fc60af0974774f120762ac1bc32b0c86..0713893f4219f74415a2441e87929c601b9d9803 100644
--- a/ui/views/animation/test/test_ink_drop_host.cc
+++ b/ui/views/animation/test/test_ink_drop_host.cc
@@ -6,6 +6,7 @@
#include "base/memory/ptr_util.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/views/animation/empty_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/square_ink_drop_ripple.h"
#include "ui/views/animation/test/ink_drop_highlight_test_api.h"
@@ -25,14 +26,16 @@ class TestInkDropRipple : public SquareInkDropRipple {
int small_corner_radius,
const gfx::Point& center_point,
SkColor color,
- float visible_opacity)
+ float visible_opacity,
+ bool overrides_highlight)
: SquareInkDropRipple(large_size,
large_corner_radius,
small_size,
small_corner_radius,
center_point,
color,
- visible_opacity) {}
+ visible_opacity),
+ overrides_highlight_(overrides_highlight) {}
~TestInkDropRipple() override {}
@@ -42,8 +45,11 @@ class TestInkDropRipple : public SquareInkDropRipple {
return test_api_.get();
}
+ bool OverridesHighlight() const override { return overrides_highlight_; }
+
private:
std::unique_ptr<test::InkDropRippleTestApi> test_api_;
+ bool overrides_highlight_;
DISALLOW_COPY_AND_ASSIGN(TestInkDropRipple);
};
@@ -77,6 +83,8 @@ class TestInkDropHighlight : public InkDropHighlight {
TestInkDropHost::TestInkDropHost()
: num_ink_drop_layers_(0),
should_show_highlight_(false),
+ should_show_ripple_(true),
+ ripple_overrides_highlight_(true),
disable_timers_for_test_(false) {}
TestInkDropHost::~TestInkDropHost() {}
@@ -91,10 +99,14 @@ void TestInkDropHost::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
std::unique_ptr<InkDropRipple> TestInkDropHost::CreateInkDropRipple() const {
gfx::Size size(10, 10);
- std::unique_ptr<InkDropRipple> ripple(new TestInkDropRipple(
- size, 5, size, 5, gfx::Point(), SK_ColorBLACK, 0.175f));
- if (disable_timers_for_test_)
- ripple->GetTestApi()->SetDisableAnimationTimers(true);
+ std::unique_ptr<InkDropRipple> ripple(new EmptyInkDropRipple());
+ if (should_show_ripple_) {
+ ripple.reset(new TestInkDropRipple(size, 5, size, 5, gfx::Point(),
+ SK_ColorBLACK, 0.175f,
+ ripple_overrides_highlight_));
+ if (disable_timers_for_test_)
+ ripple->GetTestApi()->SetDisableAnimationTimers(true);
+ }
return ripple;
}

Powered by Google App Engine
This is Rietveld 408576698