| 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/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" | 
| 6 | 6 | 
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" | 
| 8 #include "base/macros.h" | 8 #include "base/macros.h" | 
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" | 
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" | 
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 422   bool is_hovered_; | 422   bool is_hovered_; | 
| 423 | 423 | 
| 424   DISALLOW_COPY_AND_ASSIGN(TestButtonInkDropDelegate); | 424   DISALLOW_COPY_AND_ASSIGN(TestButtonInkDropDelegate); | 
| 425 }; | 425 }; | 
| 426 | 426 | 
| 427 // A generic LabelButton configured with an |InkDropDelegate|. | 427 // A generic LabelButton configured with an |InkDropDelegate|. | 
| 428 class InkDropLabelButton : public LabelButton { | 428 class InkDropLabelButton : public LabelButton { | 
| 429  public: | 429  public: | 
| 430   InkDropLabelButton() | 430   InkDropLabelButton() | 
| 431       : LabelButton(nullptr, base::string16()), | 431       : LabelButton(nullptr, base::string16()), | 
| 432         test_ink_drop_delegate_(this, this) { | 432         test_ink_drop_delegate_(new TestButtonInkDropDelegate(this, this)) { | 
| 433     set_ink_drop_delegate(&test_ink_drop_delegate_); | 433     set_ink_drop_delegate(base::WrapUnique(test_ink_drop_delegate_)); | 
| 434   } | 434   } | 
| 435 | 435 | 
| 436   ~InkDropLabelButton() override {} | 436   ~InkDropLabelButton() override {} | 
| 437 | 437 | 
| 438   TestButtonInkDropDelegate* test_ink_drop_delegate() { | 438   TestButtonInkDropDelegate* test_ink_drop_delegate() { | 
| 439     return &test_ink_drop_delegate_; | 439     return test_ink_drop_delegate_; | 
| 440   } | 440   } | 
| 441 | 441 | 
| 442  private: | 442  private: | 
| 443   TestButtonInkDropDelegate test_ink_drop_delegate_; | 443   // Weak pointer. | 
|  | 444   TestButtonInkDropDelegate* test_ink_drop_delegate_; | 
| 444 | 445 | 
| 445   DISALLOW_COPY_AND_ASSIGN(InkDropLabelButton); | 446   DISALLOW_COPY_AND_ASSIGN(InkDropLabelButton); | 
| 446 }; | 447 }; | 
| 447 | 448 | 
| 448 // Test fixture for a LabelButton that has an ink drop configured. | 449 // Test fixture for a LabelButton that has an ink drop configured. | 
| 449 class InkDropLabelButtonTest : public ViewsTestBase { | 450 class InkDropLabelButtonTest : public ViewsTestBase { | 
| 450  public: | 451  public: | 
| 451   InkDropLabelButtonTest() {} | 452   InkDropLabelButtonTest() {} | 
| 452 | 453 | 
| 453   // ViewsTestBase: | 454   // ViewsTestBase: | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 505 | 506 | 
| 506 // Verifies the target event handler View is the |LabelButton| and not any of | 507 // Verifies the target event handler View is the |LabelButton| and not any of | 
| 507 // the child Views. | 508 // the child Views. | 
| 508 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { | 509 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { | 
| 509   View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( | 510   View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( | 
| 510       button_->bounds().CenterPoint()); | 511       button_->bounds().CenterPoint()); | 
| 511   EXPECT_EQ(button_, target_view); | 512   EXPECT_EQ(button_, target_view); | 
| 512 } | 513 } | 
| 513 | 514 | 
| 514 }  // namespace views | 515 }  // namespace views | 
| OLD | NEW | 
|---|