summaryrefslogtreecommitdiffstats
path: root/views/view_unittest.cc
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:53:51 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:53:51 +0000
commitdc5e89230025a8202e0314410a388ad91138020c (patch)
tree41630518a44295112141de14f595c50e11fb84de /views/view_unittest.cc
parent668dd15b25cf7fd94fede92dd140b59c62009390 (diff)
downloadchromium_src-dc5e89230025a8202e0314410a388ad91138020c.zip
chromium_src-dc5e89230025a8202e0314410a388ad91138020c.tar.gz
chromium_src-dc5e89230025a8202e0314410a388ad91138020c.tar.bz2
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
Diffstat (limited to 'views/view_unittest.cc')
-rw-r--r--views/view_unittest.cc46
1 files changed, 46 insertions, 0 deletions
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