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

Unified Diff: ui/views/animation/test/ink_drop_impl_test_api.h

Issue 2447523002: [ash-md] Added different highlighting modes to the InkDropImpl. (Closed)
Patch Set: Fixed InkDropHostView::GetInkDrop() to use CreateInkDrop(). Created 4 years, 1 month 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 | « ui/views/animation/square_ink_drop_ripple.cc ('k') | ui/views/animation/test/ink_drop_impl_test_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/test/ink_drop_impl_test_api.h
diff --git a/ui/views/animation/test/ink_drop_impl_test_api.h b/ui/views/animation/test/ink_drop_impl_test_api.h
index 04df563c6f358ad44500c6c4a4efe2a9256d9f14..91857997ca81165fd5a34c6717df9aec163c7830 100644
--- a/ui/views/animation/test/ink_drop_impl_test_api.h
+++ b/ui/views/animation/test/ink_drop_impl_test_api.h
@@ -5,18 +5,19 @@
#ifndef UI_VIEWS_ANIMATION_TEST_INK_DROP_IMPL_TEST_API_H_
#define UI_VIEWS_ANIMATION_TEST_INK_DROP_IMPL_TEST_API_H_
+#include <memory>
#include <vector>
#include "base/macros.h"
#include "ui/compositor/test/multi_layer_animator_test_controller.h"
#include "ui/compositor/test/multi_layer_animator_test_controller_delegate.h"
+#include "ui/views/animation/ink_drop_impl.h"
namespace ui {
class LayerAnimator;
} // namespace ui
namespace views {
-class InkDropImpl;
class InkDropHighlight;
namespace test {
@@ -28,12 +29,68 @@ class InkDropImplTestApi
: public ui::test::MultiLayerAnimatorTestController,
public ui::test::MultiLayerAnimatorTestControllerDelegate {
public:
+ // Highlight state that access the HighlightStateFactory during the Exit()
+ // method.
+ class AccessFactoryOnExitHighlightState : public InkDropImpl::HighlightState {
+ public:
+ // Installs an instance of |this| to the ink drop that owns |state_factory|.
+ static void Install(InkDropImpl::HighlightStateFactory* state_factory);
+
+ explicit AccessFactoryOnExitHighlightState(
+ InkDropImpl::HighlightStateFactory* state_factory);
+
+ // HighlightState:
+ void Exit() override;
+ void ShowOnHoverChanged() override;
+ void OnHoverChanged() override;
+ void ShowOnFocusChanged() override;
+ void OnFocusChanged() override;
+ void AnimationStarted(InkDropState ink_drop_state) override;
+ void AnimationEnded(InkDropState ink_drop_state,
+ InkDropAnimationEndedReason reason) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AccessFactoryOnExitHighlightState);
+ };
+
+ // Highlight state that attempts to set a new highlight state during Exit().
+ class SetStateOnExitHighlightState : public InkDropImpl::HighlightState {
+ public:
+ // Installs an instance of |this| to the ink drop that owns |state_factory|.
+ static void Install(InkDropImpl::HighlightStateFactory* state_factory);
+
+ explicit SetStateOnExitHighlightState(
+ InkDropImpl::HighlightStateFactory* state_factory);
+
+ // HighlightState:
+ void Exit() override;
+ void ShowOnHoverChanged() override;
+ void OnHoverChanged() override;
+ void ShowOnFocusChanged() override;
+ void OnFocusChanged() override;
+ void AnimationStarted(InkDropState ink_drop_state) override;
+ void AnimationEnded(InkDropState ink_drop_state,
+ InkDropAnimationEndedReason reason) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetStateOnExitHighlightState);
+ };
+
explicit InkDropImplTestApi(InkDropImpl* ink_drop);
~InkDropImplTestApi() override;
+ // Ensures that |ink_drop_|->ShouldHighlight() returns the same value as
+ // |should_highlight| by updating the hover/focus status of |ink_drop_|.
+ void SetShouldHighlight(bool should_highlight);
+
// Wrappers to InkDropImpl internals:
+ InkDropImpl::HighlightStateFactory* state_factory() {
+ return ink_drop_->highlight_state_factory_.get();
+ }
+
const InkDropHighlight* highlight() const;
bool IsHighlightFadingInOrVisible() const;
+ bool ShouldHighlight() const;
protected:
// MultiLayerAnimatorTestControllerDelegate:
« no previous file with comments | « ui/views/animation/square_ink_drop_ripple.cc ('k') | ui/views/animation/test/ink_drop_impl_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698