From dc5e89230025a8202e0314410a388ad91138020c Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Tue, 1 Sep 2009 22:53:51 +0000 Subject: The FocusManager stores/restores focus when the top window becomes inactive/active. BUG=None TEST=Run the focus manager unit-tests. Review URL: http://codereview.chromium.org/164448 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25108 0039d316-1c4b-4281-b951-d872f2087c98 --- views/view_unittest.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'views/view_unittest.cc') diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 64b5848..9d2fa87 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1185,3 +1185,49 @@ TEST_F(DefaultButtonTest, DialogDefaultButtonTest) { SimularePressingEnterAndCheckDefaultButton(CANCEL); } #endif + +#if defined(OS_LINUX) +class TestViewWithControls : public View { + public: + TestViewWithControls() { + button_ = new NativeButton(NULL, L"Button"); + checkbox_ = new Checkbox(L"My checkbox"); + text_field_ = new Textfield(); + AddChildView(button_); + button_->SetBounds(0, 0, 100, 30); + AddChildView(checkbox_); + checkbox_->SetBounds(0, 100, 100, 30); + AddChildView(text_field_); + text_field_->SetBounds(0, 200, 100, 30); + text_field_->SetBackgroundColor(SK_ColorYELLOW); + text_field_->SetFont(gfx::Font::CreateFont(L"Arial", 30)); + } + + Button* button_; + Checkbox* checkbox_; + Textfield* text_field_; +}; + +class SimpleWindowDelegate : public WindowDelegate { + public: + SimpleWindowDelegate(View* contents) : contents_(contents) { } + + virtual void DeleteDelegate() { delete this; } + + virtual View* GetContentsView() { return contents_; } + + private: + View* contents_; +}; + +TEST_F(ViewTest, DISABLED_Stupid) { + TestViewWithControls* view_with_controls = new TestViewWithControls(); + views::Window* window = + views::Window::CreateChromeWindow( + NULL, gfx::Rect(200, 200, 500, 500), + new SimpleWindowDelegate(view_with_controls)); + window->Show(); + AcceleratorHandler accelerator_handler; + MessageLoopForUI::current()->Run(&accelerator_handler); +} +#endif -- cgit v1.1