Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_root_window_host_win_unittest.cc

Issue 49303007: Moves responsibility of invoking OnNativeWidgetCreated to DesktopRootWindowHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 2 trunk Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698