| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/button/custom_button.h" | 5 #include "ui/views/controls/button/custom_button.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 delete button_; | 140 delete button_; |
| 141 button_ = new TestCustomButton(has_ink_drop_action_on_click); | 141 button_ = new TestCustomButton(has_ink_drop_action_on_click); |
| 142 InkDropHostViewTestApi(button_).SetInkDrop(std::move(ink_drop)); | 142 InkDropHostViewTestApi(button_).SetInkDrop(std::move(ink_drop)); |
| 143 widget_->SetContentsView(button_); | 143 widget_->SetContentsView(button_); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void CreateButtonWithRealInkDrop() { | 146 void CreateButtonWithRealInkDrop() { |
| 147 delete button_; | 147 delete button_; |
| 148 button_ = new TestCustomButton(false); | 148 button_ = new TestCustomButton(false); |
| 149 InkDropHostViewTestApi(button_).SetInkDrop( | 149 InkDropHostViewTestApi(button_).SetInkDrop( |
| 150 base::MakeUnique<InkDropImpl>(button_)); | 150 base::MakeUnique<InkDropImpl>(button_, button_->size())); |
| 151 widget_->SetContentsView(button_); | 151 widget_->SetContentsView(button_); |
| 152 } | 152 } |
| 153 | 153 |
| 154 protected: | 154 protected: |
| 155 Widget* widget() { return widget_.get(); } | 155 Widget* widget() { return widget_.get(); } |
| 156 TestCustomButton* button() { return button_; } | 156 TestCustomButton* button() { return button_; } |
| 157 void SetDraggedView(View* dragged_view) { | 157 void SetDraggedView(View* dragged_view) { |
| 158 widget_->dragged_view_ = dragged_view; | 158 widget_->dragged_view_ = dragged_view; |
| 159 } | 159 } |
| 160 | 160 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state()); | 643 EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state()); |
| 644 EXPECT_FALSE(button()->pressed()); | 644 EXPECT_FALSE(button()->pressed()); |
| 645 | 645 |
| 646 ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE); | 646 ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE); |
| 647 SimulateKeyEvent(&space_release); | 647 SimulateKeyEvent(&space_release); |
| 648 EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state()); | 648 EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state()); |
| 649 EXPECT_TRUE(button()->pressed()); | 649 EXPECT_TRUE(button()->pressed()); |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace views | 652 } // namespace views |
| OLD | NEW |