| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 // An extension to WidgetBoundsChanged to ensure notifications are forwarded | 998 // An extension to WidgetBoundsChanged to ensure notifications are forwarded |
| 999 // by the NativeWidget implementation. | 999 // by the NativeWidget implementation. |
| 1000 TEST_F(WidgetObserverTest, WidgetBoundsChangedNative) { | 1000 TEST_F(WidgetObserverTest, WidgetBoundsChangedNative) { |
| 1001 // Don't use NewWidget(), so that the Init() flow can be observed to ensure | 1001 // Don't use NewWidget(), so that the Init() flow can be observed to ensure |
| 1002 // consistency across platforms. | 1002 // consistency across platforms. |
| 1003 Widget* widget = new Widget(); // Note: owned by NativeWidget. | 1003 Widget* widget = new Widget(); // Note: owned by NativeWidget. |
| 1004 widget->AddObserver(this); | 1004 widget->AddObserver(this); |
| 1005 | 1005 |
| 1006 EXPECT_FALSE(widget_bounds_changed()); | 1006 EXPECT_FALSE(widget_bounds_changed()); |
| 1007 | 1007 |
| 1008 // Init causes a bounds change, even while not showing. | 1008 // Init causes a bounds change, even while not showing. Note some platforms |
| 1009 widget->Init(CreateParams(Widget::InitParams::TYPE_WINDOW)); | 1009 // cause a bounds change even when the bounds are empty. Mac does not. |
| 1010 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 1011 params.bounds = gfx::Rect(0, 0, 100, 100); |
| 1012 widget->Init(params); |
| 1010 EXPECT_TRUE(widget_bounds_changed()); | 1013 EXPECT_TRUE(widget_bounds_changed()); |
| 1011 reset(); | 1014 reset(); |
| 1012 | 1015 |
| 1013 // Resizing while hidden, triggers a change. | 1016 // Resizing while hidden, triggers a change. |
| 1014 widget->SetSize(gfx::Size(160, 100)); | 1017 widget->SetSize(gfx::Size(160, 100)); |
| 1015 EXPECT_FALSE(widget->IsVisible()); | 1018 EXPECT_FALSE(widget->IsVisible()); |
| 1016 EXPECT_TRUE(widget_bounds_changed()); | 1019 EXPECT_TRUE(widget_bounds_changed()); |
| 1017 reset(); | 1020 reset(); |
| 1018 | 1021 |
| 1019 // Setting the same size does nothing. | 1022 // Setting the same size does nothing. |
| (...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3409 bool handled = false; | 3412 bool handled = false; |
| 3410 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); | 3413 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); |
| 3411 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); | 3414 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); |
| 3412 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); | 3415 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); |
| 3413 widget.CloseNow(); | 3416 widget.CloseNow(); |
| 3414 } | 3417 } |
| 3415 #endif | 3418 #endif |
| 3416 | 3419 |
| 3417 } // namespace test | 3420 } // namespace test |
| 3418 } // namespace views | 3421 } // namespace views |
| OLD | NEW |