| 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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class LabelButtonTest : public test::WidgetTest { | 58 class LabelButtonTest : public test::WidgetTest { |
| 59 public: | 59 public: |
| 60 LabelButtonTest() {} | 60 LabelButtonTest() {} |
| 61 | 61 |
| 62 // Adds a LabelButton to the test Widget with the STYLE_BUTTON platform style. | 62 // Adds a LabelButton to the test Widget with the STYLE_BUTTON platform style. |
| 63 TestLabelButton* AddStyledButton(const char* label, bool is_default) { | 63 TestLabelButton* AddStyledButton(const char* label, bool is_default) { |
| 64 TestLabelButton* button = new TestLabelButton; | 64 TestLabelButton* button = new TestLabelButton; |
| 65 button->SetText(ASCIIToUTF16(label)); | 65 button->SetText(ASCIIToUTF16(label)); |
| 66 button->SetStyle(CustomButton::STYLE_BUTTON); | 66 button->SetStyleDeprecated(CustomButton::STYLE_BUTTON); |
| 67 if (is_default) | 67 if (is_default) |
| 68 button->SetIsDefault(true); | 68 button->SetIsDefault(true); |
| 69 button_->GetWidget()->GetContentsView()->AddChildView(button); | 69 button_->GetWidget()->GetContentsView()->AddChildView(button); |
| 70 button->SizeToPreferredSize(); | 70 button->SizeToPreferredSize(); |
| 71 button->Layout(); | 71 button->Layout(); |
| 72 return button; | 72 return button; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // testing::Test: | 75 // testing::Test: |
| 76 void SetUp() override { | 76 void SetUp() override { |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 509 |
| 510 // Verifies the target event handler View is the |LabelButton| and not any of | 510 // Verifies the target event handler View is the |LabelButton| and not any of |
| 511 // the child Views. | 511 // the child Views. |
| 512 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { | 512 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { |
| 513 View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( | 513 View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( |
| 514 button_->bounds().CenterPoint()); | 514 button_->bounds().CenterPoint()); |
| 515 EXPECT_EQ(button_, target_view); | 515 EXPECT_EQ(button_, target_view); |
| 516 } | 516 } |
| 517 | 517 |
| 518 } // namespace views | 518 } // namespace views |
| OLD | NEW |