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

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

Issue 82113004: Fix key navigation to cut/copy/paste zoom button on wrench menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/custom_button.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button_unittest.cc
diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc
index 061bbd6826de1dc2f7b09355ef30a27bc193db46..c3b661d68a3770e70dee3c0b98b42a833c9cfd83 100644
--- a/ui/views/controls/button/custom_button_unittest.cc
+++ b/ui/views/controls/button/custom_button_unittest.cc
@@ -7,6 +7,13 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/layout.h"
#include "ui/gfx/screen.h"
+#include "ui/views/controls/button/checkbox.h"
+#include "ui/views/controls/button/image_button.h"
+#include "ui/views/controls/button/menu_button.h"
+#include "ui/views/controls/button/radio_button.h"
+#include "ui/views/controls/button/text_button.h"
+#include "ui/views/controls/link.h"
+#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/test/views_test_base.h"
#if defined(USE_AURA)
@@ -101,4 +108,34 @@ TEST_F(CustomButtonTest, HoverStateOnVisibilityChange) {
#endif
}
+// Make sure all subclasses of CustomButton are correctly recognized
+// as CustomButton.
+TEST_F(CustomButtonTest, AsCustomButton) {
+ string16 text;
+
+ TextButton text_button(NULL, text);
+ EXPECT_TRUE(CustomButton::AsCustomButton(&text_button));
+
+ ImageButton image_button(NULL);
+ EXPECT_TRUE(CustomButton::AsCustomButton(&image_button));
+
+ Checkbox checkbox(text);
+ EXPECT_TRUE(CustomButton::AsCustomButton(&checkbox));
+
+ RadioButton radio_button(text, 0);
+ EXPECT_TRUE(CustomButton::AsCustomButton(&radio_button));
+
+ MenuButton menu_button(NULL, text, NULL, false);
+ EXPECT_TRUE(CustomButton::AsCustomButton(&menu_button));
+
+ Label label;
+ EXPECT_FALSE(CustomButton::AsCustomButton(&label));
+
+ Link link(text);
+ EXPECT_FALSE(CustomButton::AsCustomButton(&link));
+
+ Textfield textfield(Textfield::STYLE_DEFAULT);
+ EXPECT_FALSE(CustomButton::AsCustomButton(&textfield));
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698