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