From a4ac1b744e4c0caef3e2a4aec035fb5ed61d245a Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Tue, 30 Jun 2009 15:06:10 +0000 Subject: Review URL: http://codereview.chromium.org/150051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19582 0039d316-1c4b-4281-b951-d872f2087c98 --- views/focus/focus_manager_unittest.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'views/focus') diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index cc56271..4f50527 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -18,6 +18,7 @@ #include "views/controls/button/native_button.h" #include "views/controls/button/radio_button.h" #include "views/controls/combobox/combobox.h" +#include "views/controls/combobox/native_combobox_wrapper.h" #include "views/controls/label.h" #include "views/controls/link.h" #include "views/controls/scroll_view.h" @@ -725,6 +726,20 @@ class TestTextfield : public Textfield { } }; +class TestCombobox : public Combobox, public Combobox::Model { + public: + TestCombobox() : Combobox(this) { } + virtual HWND TestGetNativeComponent() { + return native_wrapper_->GetTestingHandle(); + } + virtual int GetItemCount(Combobox* source) { + return 10; + } + virtual std::wstring GetItemAt(Combobox* source, int index) { + return L"Hello combo"; + } +}; + class TestTabbedPane : public TabbedPane { public: TestTabbedPane() { } @@ -740,6 +755,7 @@ TEST_F(FocusManagerTest, FocusNativeControls) { TestCheckbox* checkbox = new TestCheckbox(L"Checkbox"); TestRadioButton* radio_button = new TestRadioButton(L"RadioButton"); TestTextfield* textfield = new TestTextfield(); + TestCombobox* combobox = new TestCombobox(); TestTabbedPane* tabbed_pane = new TestTabbedPane(); TestNativeButton* tab_button = new TestNativeButton(L"tab button"); @@ -747,6 +763,7 @@ TEST_F(FocusManagerTest, FocusNativeControls) { content_view_->AddChildView(checkbox); content_view_->AddChildView(radio_button); content_view_->AddChildView(textfield); + content_view_->AddChildView(combobox); content_view_->AddChildView(tabbed_pane); tabbed_pane->AddTab(L"Awesome tab", tab_button); @@ -764,6 +781,9 @@ TEST_F(FocusManagerTest, FocusNativeControls) { ::SendMessage(textfield->TestGetNativeComponent(), WM_SETFOCUS, NULL, NULL); EXPECT_EQ(textfield, GetFocusManager()->GetFocusedView()); + ::SendMessage(combobox->TestGetNativeComponent(), WM_SETFOCUS, NULL, NULL); + EXPECT_EQ(combobox, GetFocusManager()->GetFocusedView()); + ::SendMessage(tabbed_pane->TestGetNativeControlHWND(), WM_SETFOCUS, NULL, NULL); EXPECT_EQ(tabbed_pane, GetFocusManager()->GetFocusedView()); -- cgit v1.1