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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc

Issue 1748903003: Resets hover state when ToolbarActionView is dragged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resets hover state when ToolbarActionView is dragged (hide set_dragged_view) Created 4 years, 10 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: chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc b/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc
index a7afc4194b910b72af2d0f01ae9e20f5c764552f..3b6fe74fb106506803bc2e3178eeec47bc1e237e 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc
@@ -117,8 +117,13 @@ class ToolbarActionViewUnitTest : public views::ViewsTestBase {
views::ViewsTestBase::TearDown();
}
+ protected:
views::Widget* widget() { return widget_; }
+ void SetDraggedView(views::View* dragged_view) {
+ widget()->set_dragged_view(dragged_view);
+ }
+
private:
// The widget managed by this test.
views::Widget* widget_;
@@ -192,6 +197,16 @@ TEST_F(ToolbarActionViewUnitTest, BasicToolbarActionViewTest) {
controller.HidePopup();
EXPECT_EQ(views::Button::STATE_NORMAL, view.state());
+ // Simulate dragging |view|. Once a drag is started a capture loss should
+ // reset button state.
+ view.SetHotTracked(true);
+ EXPECT_EQ(views::Button::ButtonState::STATE_HOVERED, view.state());
+ SetDraggedView(&view);
+ widget()->SetCapture(&view);
+ widget()->ReleaseCapture();
+ EXPECT_EQ(views::Button::ButtonState::STATE_NORMAL, view.state());
+ SetDraggedView(nullptr);
+
// Ensure that the button's enabled state reflects that of the controller.
controller.SetEnabled(false);
EXPECT_EQ(views::Button::STATE_DISABLED, view.state());

Powered by Google App Engine
This is Rietveld 408576698