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 "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/base/layout.h" | 8 #include "ui/base/layout.h" |
9 #include "ui/gfx/screen.h" | 9 #include "ui/gfx/screen.h" |
10 #include "ui/views/controls/button/checkbox.h" | 10 #include "ui/views/controls/button/checkbox.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 PerformGesture(button, ui::ET_GESTURE_TAP_CANCEL); | 149 PerformGesture(button, ui::ET_GESTURE_TAP_CANCEL); |
150 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state()); | 150 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state()); |
151 } | 151 } |
152 | 152 |
153 #endif // USE_AURA | 153 #endif // USE_AURA |
154 | 154 |
155 // Make sure all subclasses of CustomButton are correctly recognized | 155 // Make sure all subclasses of CustomButton are correctly recognized |
156 // as CustomButton. | 156 // as CustomButton. |
157 TEST_F(CustomButtonTest, AsCustomButton) { | 157 TEST_F(CustomButtonTest, AsCustomButton) { |
158 string16 text; | 158 base::string16 text; |
159 | 159 |
160 TextButton text_button(NULL, text); | 160 TextButton text_button(NULL, text); |
161 EXPECT_TRUE(CustomButton::AsCustomButton(&text_button)); | 161 EXPECT_TRUE(CustomButton::AsCustomButton(&text_button)); |
162 | 162 |
163 ImageButton image_button(NULL); | 163 ImageButton image_button(NULL); |
164 EXPECT_TRUE(CustomButton::AsCustomButton(&image_button)); | 164 EXPECT_TRUE(CustomButton::AsCustomButton(&image_button)); |
165 | 165 |
166 Checkbox checkbox(text); | 166 Checkbox checkbox(text); |
167 EXPECT_TRUE(CustomButton::AsCustomButton(&checkbox)); | 167 EXPECT_TRUE(CustomButton::AsCustomButton(&checkbox)); |
168 | 168 |
169 RadioButton radio_button(text, 0); | 169 RadioButton radio_button(text, 0); |
170 EXPECT_TRUE(CustomButton::AsCustomButton(&radio_button)); | 170 EXPECT_TRUE(CustomButton::AsCustomButton(&radio_button)); |
171 | 171 |
172 MenuButton menu_button(NULL, text, NULL, false); | 172 MenuButton menu_button(NULL, text, NULL, false); |
173 EXPECT_TRUE(CustomButton::AsCustomButton(&menu_button)); | 173 EXPECT_TRUE(CustomButton::AsCustomButton(&menu_button)); |
174 | 174 |
175 Label label; | 175 Label label; |
176 EXPECT_FALSE(CustomButton::AsCustomButton(&label)); | 176 EXPECT_FALSE(CustomButton::AsCustomButton(&label)); |
177 | 177 |
178 Link link(text); | 178 Link link(text); |
179 EXPECT_FALSE(CustomButton::AsCustomButton(&link)); | 179 EXPECT_FALSE(CustomButton::AsCustomButton(&link)); |
180 | 180 |
181 Textfield textfield(Textfield::STYLE_DEFAULT); | 181 Textfield textfield(Textfield::STYLE_DEFAULT); |
182 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield)); | 182 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield)); |
183 } | 183 } |
184 | 184 |
185 } // namespace views | 185 } // namespace views |
OLD | NEW |