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

Unified Diff: views/focus/focus_manager_unittest.cc

Issue 122002: Moving the WM_SETFOCUS message processing out of FocusManager (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « views/focus/focus_manager.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/focus/focus_manager_unittest.cc
===================================================================
--- views/focus/focus_manager_unittest.cc (revision 18286)
+++ views/focus/focus_manager_unittest.cc (working copy)
@@ -699,6 +699,24 @@
}
};
+class TestCheckbox : public Checkbox {
+ public:
+ explicit TestCheckbox(const std::wstring& text) : Checkbox(text) {
+ };
+ virtual HWND TestGetNativeControlHWND() {
+ return native_wrapper_->GetTestingHandle();
+ }
+};
+
+class TestRadioButton : public RadioButton {
+ public:
+ explicit TestRadioButton(const std::wstring& text) : RadioButton(text, 1) {
+ };
+ virtual HWND TestGetNativeControlHWND() {
+ return native_wrapper_->GetTestingHandle();
+ }
+};
+
class TestTextfield : public Textfield {
public:
TestTextfield() { }
@@ -719,11 +737,15 @@
// FocusManager.
TEST_F(FocusManagerTest, FocusNativeControls) {
TestNativeButton* button = new TestNativeButton(L"Press me");
+ TestCheckbox* checkbox = new TestCheckbox(L"Checkbox");
+ TestRadioButton* radio_button = new TestRadioButton(L"RadioButton");
TestTextfield* textfield = new TestTextfield();
TestTabbedPane* tabbed_pane = new TestTabbedPane();
TestNativeButton* tab_button = new TestNativeButton(L"tab button");
content_view_->AddChildView(button);
+ content_view_->AddChildView(checkbox);
+ content_view_->AddChildView(radio_button);
content_view_->AddChildView(textfield);
content_view_->AddChildView(tabbed_pane);
tabbed_pane->AddTab(L"Awesome tab", tab_button);
@@ -732,6 +754,13 @@
::SendMessage(button->TestGetNativeControlHWND(), WM_SETFOCUS, NULL, NULL);
EXPECT_EQ(button, GetFocusManager()->GetFocusedView());
+ ::SendMessage(checkbox->TestGetNativeControlHWND(), WM_SETFOCUS, NULL, NULL);
+ EXPECT_EQ(checkbox, GetFocusManager()->GetFocusedView());
+
+ ::SendMessage(radio_button->TestGetNativeControlHWND(), WM_SETFOCUS,
+ NULL, NULL);
+ EXPECT_EQ(radio_button, GetFocusManager()->GetFocusedView());
+
::SendMessage(textfield->TestGetNativeComponent(), WM_SETFOCUS, NULL, NULL);
EXPECT_EQ(textfield, GetFocusManager()->GetFocusedView());
« no previous file with comments | « views/focus/focus_manager.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698