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

Unified Diff: ui/views/controls/button/label_button_unittest.cc

Issue 1216673005: views::LabelButton should not call virtual methods from its constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150703-Views-ButtonBorderRefactor
Patch Set: selfnits Created 5 years, 5 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: ui/views/controls/button/label_button_unittest.cc
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc
index 05a81a77fa16feceaf5c0a8ff195af91733673c7..3a92b70bed33951d3893fbbb5e002856004b339d 100644
--- a/ui/views/controls/button/label_button_unittest.cc
+++ b/ui/views/controls/button/label_button_unittest.cc
@@ -30,7 +30,8 @@ typedef ViewsTestBase LabelButtonTest;
TEST_F(LabelButtonTest, Init) {
const base::string16 text(ASCIIToUTF16("abc"));
- LabelButton button(NULL, text);
+ LabelButton button(nullptr);
+ button.Init(text);
EXPECT_TRUE(button.GetImage(Button::STATE_NORMAL).isNull());
EXPECT_TRUE(button.GetImage(Button::STATE_HOVERED).isNull());
@@ -48,7 +49,9 @@ TEST_F(LabelButtonTest, Init) {
}
TEST_F(LabelButtonTest, Label) {
- LabelButton button(NULL, base::string16());
+ LabelButton button(nullptr);
+ EXPECT_TRUE(button.GetText().empty());
+ button.Init(base::string16());
EXPECT_TRUE(button.GetText().empty());
const gfx::FontList font_list;
@@ -79,7 +82,8 @@ TEST_F(LabelButtonTest, Label) {
}
TEST_F(LabelButtonTest, Image) {
- LabelButton button(NULL, base::string16());
+ LabelButton button(nullptr);
+ button.Init(base::string16());
const int small_size = 50, large_size = 100;
const gfx::ImageSkia small_image = CreateTestImage(small_size, small_size);
@@ -111,7 +115,8 @@ TEST_F(LabelButtonTest, Image) {
}
TEST_F(LabelButtonTest, LabelAndImage) {
- LabelButton button(NULL, base::string16());
+ LabelButton button(nullptr);
+ button.Init(base::string16());
const gfx::FontList font_list;
const base::string16 text(ASCIIToUTF16("abcdefghijklm"));
@@ -169,7 +174,8 @@ TEST_F(LabelButtonTest, LabelAndImage) {
TEST_F(LabelButtonTest, FontList) {
const base::string16 text(ASCIIToUTF16("abc"));
- LabelButton button(NULL, text);
+ LabelButton button(nullptr);
+ button.Init(text);
const gfx::FontList original_font_list = button.GetFontList();
const gfx::FontList large_font_list =
@@ -193,7 +199,8 @@ TEST_F(LabelButtonTest, FontList) {
TEST_F(LabelButtonTest, ChangeTextSize) {
const base::string16 text(ASCIIToUTF16("abc"));
const base::string16 longer_text(ASCIIToUTF16("abcdefghijklm"));
- LabelButton button(NULL, text);
+ LabelButton button(nullptr);
+ button.Init(text);
const int original_width = button.GetPreferredSize().width();
@@ -208,7 +215,8 @@ TEST_F(LabelButtonTest, ChangeTextSize) {
}
TEST_F(LabelButtonTest, ChangeLabelImageSpacing) {
- LabelButton button(NULL, ASCIIToUTF16("abc"));
+ LabelButton button(nullptr);
+ button.Init(ASCIIToUTF16("abc"));
button.SetImage(Button::STATE_NORMAL, CreateTestImage(50, 50));
const int kOriginalSpacing = 5;

Powered by Google App Engine
This is Rietveld 408576698