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

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: self review 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
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..941332fea361d7cbe9d405e8f66c9d3e096151b6 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.InitAsTextbutton(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.InitAsTextbutton(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.InitAsTextbutton(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.InitAsTextbutton(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.InitAsTextbutton(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.InitAsTextbutton(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.InitAsTextbutton(ASCIIToUTF16("abc"));
button.SetImage(Button::STATE_NORMAL, CreateTestImage(50, 50));
const int kOriginalSpacing = 5;
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698