| 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_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
| 9 #include "ui/aura/test/test_window_delegate.h" | 9 #include "ui/aura/test/test_window_delegate.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 23 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
| 24 Widget widget; | 24 Widget widget; |
| 25 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); | 25 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 26 params.bounds = gfx::Rect(0, 0, 200, 200); | 26 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 27 params.parent = window.get(); | 27 params.parent = window.get(); |
| 28 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 28 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 29 params.native_widget = new DesktopNativeWidgetAura(&widget); | 29 params.native_widget = new DesktopNativeWidgetAura(&widget); |
| 30 widget.Init(params); | 30 widget.Init(params); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Verifies that the AURA windows making up a widget instance have the correct | 33 // Verifies that the Aura windows making up a widget instance have the correct |
| 34 // bounds after the widget is resized. | 34 // bounds after the widget is resized. |
| 35 TEST_F(DesktopNativeWidgetAuraTest, DesktopAuraWindowSizeTest) { | 35 TEST_F(DesktopNativeWidgetAuraTest, DesktopAuraWindowSizeTest) { |
| 36 Widget widget; | 36 Widget widget; |
| 37 |
| 38 // On Linux we test this with popup windows because the WM may ignore the size |
| 39 // suggestion for normal windows. |
| 40 #if defined(OS_LINUX) |
| 41 Widget::InitParams init_params = |
| 42 CreateParams(Widget::InitParams::TYPE_POPUP); |
| 43 #else |
| 37 Widget::InitParams init_params = | 44 Widget::InitParams init_params = |
| 38 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 45 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 46 #endif |
| 47 |
| 39 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 48 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 40 init_params.native_widget = new DesktopNativeWidgetAura(&widget); | 49 init_params.native_widget = new DesktopNativeWidgetAura(&widget); |
| 41 widget.Init(init_params); | 50 widget.Init(init_params); |
| 42 | 51 |
| 43 gfx::Rect bounds(0, 0, 100, 100); | 52 gfx::Rect bounds(0, 0, 100, 100); |
| 44 widget.SetBounds(bounds); | 53 widget.SetBounds(bounds); |
| 45 widget.Show(); | 54 widget.Show(); |
| 46 | 55 |
| 47 EXPECT_EQ(bounds.ToString(), | 56 EXPECT_EQ(bounds.ToString(), |
| 48 widget.GetNativeView()->GetRootWindow()->bounds().ToString()); | 57 widget.GetNativeView()->GetRootWindow()->bounds().ToString()); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 219 |
| 211 // Post a task that terminates the nested loop and destroyes the widget. This | 220 // Post a task that terminates the nested loop and destroyes the widget. This |
| 212 // task will be executed from the nested loop initiated with the call to | 221 // task will be executed from the nested loop initiated with the call to |
| 213 // |RunWithDispatcher()| below. | 222 // |RunWithDispatcher()| below. |
| 214 message_loop()->PostTask(FROM_HERE, | 223 message_loop()->PostTask(FROM_HERE, |
| 215 base::Bind(&QuitNestedLoopAndCloseWidget, base::Passed(&widget), client)); | 224 base::Bind(&QuitNestedLoopAndCloseWidget, base::Passed(&widget), client)); |
| 216 client->RunWithDispatcher(NULL); | 225 client->RunWithDispatcher(NULL); |
| 217 } | 226 } |
| 218 | 227 |
| 219 } // namespace views | 228 } // namespace views |
| OLD | NEW |