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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ui/views/controls/button/image_button.h"
12 #include "ui/views/controls/button/menu_button.h"
13 #include "ui/views/controls/button/radio_button.h"
14 #include "ui/views/controls/button/text_button.h"
15 #include "ui/views/controls/link.h"
16 #include "ui/views/controls/textfield/textfield.h"
10 #include "ui/views/test/views_test_base.h" 17 #include "ui/views/test/views_test_base.h"
11 18
12 #if defined(USE_AURA) 19 #if defined(USE_AURA)
13 #include "ui/aura/root_window.h" 20 #include "ui/aura/root_window.h"
14 #include "ui/aura/test/test_cursor_client.h" 21 #include "ui/aura/test/test_cursor_client.h"
15 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
16 #endif 23 #endif
17 24
18 namespace views { 25 namespace views {
19 26
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state()); 101 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state());
95 102
96 button->SetVisible(false); 103 button->SetVisible(false);
97 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state()); 104 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state());
98 105
99 button->SetVisible(true); 106 button->SetVisible(true);
100 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state()); 107 EXPECT_EQ(CustomButton::STATE_NORMAL, button->state());
101 #endif 108 #endif
102 } 109 }
103 110
111 // Make sure all subclasses of CustomButton are correctly recognized
112 // as CustomButton.
113 TEST_F(CustomButtonTest, AsCustomButton) {
114 string16 text;
115
116 TextButton text_button(NULL, text);
117 EXPECT_TRUE(CustomButton::AsCustomButton(&text_button));
118
119 ImageButton image_button(NULL);
120 EXPECT_TRUE(CustomButton::AsCustomButton(&image_button));
121
122 Checkbox checkbox(text);
123 EXPECT_TRUE(CustomButton::AsCustomButton(&checkbox));
124
125 RadioButton radio_button(text, 0);
126 EXPECT_TRUE(CustomButton::AsCustomButton(&radio_button));
127
128 MenuButton menu_button(NULL, text, NULL, false);
129 EXPECT_TRUE(CustomButton::AsCustomButton(&menu_button));
130
131 Label label;
132 EXPECT_FALSE(CustomButton::AsCustomButton(&label));
133
134 Link link(text);
135 EXPECT_FALSE(CustomButton::AsCustomButton(&link));
136
137 Textfield textfield(Textfield::STYLE_DEFAULT);
138 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield));
139 }
140
104 } // namespace views 141 } // namespace views
OLDNEW
« 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