OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
| 6 |
| 7 #include "ui/aura/root_window.h" |
| 8 #include "ui/views/test/views_test_base.h" |
| 9 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 10 #include "ui/views/widget/widget.h" |
| 11 |
| 12 namespace views { |
| 13 |
| 14 typedef ViewsTestBase DesktopRootWindowHostWinTest; |
| 15 |
| 16 namespace { |
| 17 |
| 18 // See description above SaveFocusOnDeactivateFromHandleCreate. |
| 19 class TestDesktopRootWindowHostWin : public DesktopRootWindowHostWin { |
| 20 public: |
| 21 TestDesktopRootWindowHostWin( |
| 22 internal::NativeWidgetDelegate* native_widget_delegate, |
| 23 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 24 : DesktopRootWindowHostWin(native_widget_delegate, |
| 25 desktop_native_widget_aura) {} |
| 26 virtual ~TestDesktopRootWindowHostWin() {} |
| 27 |
| 28 // DesktopRootWindowHostWin overrides: |
| 29 virtual void HandleCreate() OVERRIDE { |
| 30 DesktopRootWindowHostWin::HandleCreate(); |
| 31 SaveFocusOnDeactivate(); |
| 32 } |
| 33 |
| 34 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(TestDesktopRootWindowHostWin); |
| 36 }; |
| 37 |
| 38 } // namespace |
| 39 |
| 40 // Verifies if SaveFocusOnDeactivate() is invoked from |
| 41 // DesktopRootWindowHostWin::HandleCreate we don't crash. |
| 42 TEST_F(DesktopRootWindowHostWinTest, SaveFocusOnDeactivateFromHandleCreate) { |
| 43 Widget widget; |
| 44 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 45 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 46 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 47 DesktopNativeWidgetAura* desktop_native_widget_aura = |
| 48 new DesktopNativeWidgetAura(&widget); |
| 49 params.native_widget = desktop_native_widget_aura; |
| 50 params.desktop_root_window_host = new TestDesktopRootWindowHostWin( |
| 51 &widget, desktop_native_widget_aura); |
| 52 widget.Init(params); |
| 53 } |
| 54 |
| 55 } // namespace views |
OLD | NEW |