| 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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3384 ::PostMessage(window, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(100, 100)); | 3384 ::PostMessage(window, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(100, 100)); |
| 3385 ::PostMessage(window, WM_NCMOUSEMOVE, HTCAPTION, MAKELPARAM(110, 110)); | 3385 ::PostMessage(window, WM_NCMOUSEMOVE, HTCAPTION, MAKELPARAM(110, 110)); |
| 3386 RunPendingMessages(); | 3386 RunPendingMessages(); |
| 3387 | 3387 |
| 3388 EXPECT_TRUE(subclass_helper.received_message(WM_NCLBUTTONDOWN)); | 3388 EXPECT_TRUE(subclass_helper.received_message(WM_NCLBUTTONDOWN)); |
| 3389 EXPECT_TRUE(subclass_helper.received_message(WM_SYSCOMMAND)); | 3389 EXPECT_TRUE(subclass_helper.received_message(WM_SYSCOMMAND)); |
| 3390 | 3390 |
| 3391 widget.CloseNow(); | 3391 widget.CloseNow(); |
| 3392 } | 3392 } |
| 3393 | 3393 |
| 3394 // On Windows if we create a fullscreen window on a thread, then it affects the |
| 3395 // way other windows on the thread interact with the taskbar. To workaround |
| 3396 // this we switch the fullscreen state of a window when it loses activation to |
| 3397 // a window on the same monitor. This test verifies the same. |
| 3398 TEST_F(WidgetTest, FullscreenStateSwitchedOnActivationLoss) { |
| 3399 Widget widget1; |
| 3400 Widget::InitParams params = |
| 3401 CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 3402 params.native_widget = new PlatformDesktopNativeWidget(&widget1); |
| 3403 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 3404 widget1.Init(params); |
| 3405 widget1.SetBounds(gfx::Rect(0, 0, 200, 200)); |
| 3406 widget1.Show(); |
| 3407 |
| 3408 Widget widget2; |
| 3409 params.native_widget = new PlatformDesktopNativeWidget(&widget2); |
| 3410 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 3411 widget2.Init(params); |
| 3412 widget2.SetBounds(gfx::Rect(0, 0, 200, 200)); |
| 3413 widget2.Show(); |
| 3414 |
| 3415 widget1.SetFullscreen(true); |
| 3416 EXPECT_TRUE(widget1.IsFullscreen()); |
| 3417 |
| 3418 widget2.Activate(); |
| 3419 |
| 3420 EXPECT_FALSE(widget1.IsFullscreen()); |
| 3421 |
| 3422 widget1.CloseNow(); |
| 3423 widget2.CloseNow(); |
| 3424 } |
| 3394 #endif | 3425 #endif |
| 3395 | 3426 |
| 3396 // Test that SetAlwaysOnTop and IsAlwaysOnTop are consistent. | 3427 // Test that SetAlwaysOnTop and IsAlwaysOnTop are consistent. |
| 3397 TEST_F(WidgetTest, AlwaysOnTop) { | 3428 TEST_F(WidgetTest, AlwaysOnTop) { |
| 3398 WidgetAutoclosePtr widget(CreateTopLevelNativeWidget()); | 3429 WidgetAutoclosePtr widget(CreateTopLevelNativeWidget()); |
| 3399 EXPECT_FALSE(widget->IsAlwaysOnTop()); | 3430 EXPECT_FALSE(widget->IsAlwaysOnTop()); |
| 3400 widget->SetAlwaysOnTop(true); | 3431 widget->SetAlwaysOnTop(true); |
| 3401 EXPECT_TRUE(widget->IsAlwaysOnTop()); | 3432 EXPECT_TRUE(widget->IsAlwaysOnTop()); |
| 3402 widget->SetAlwaysOnTop(false); | 3433 widget->SetAlwaysOnTop(false); |
| 3403 EXPECT_FALSE(widget->IsAlwaysOnTop()); | 3434 EXPECT_FALSE(widget->IsAlwaysOnTop()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3513 // Moving the child to a different widget should call the removals observer. | 3544 // Moving the child to a different widget should call the removals observer. |
| 3514 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget()); | 3545 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget()); |
| 3515 widget2->client_view()->AddChildView(child); | 3546 widget2->client_view()->AddChildView(child); |
| 3516 EXPECT_TRUE(removals_observer.DidRemoveView(child)); | 3547 EXPECT_TRUE(removals_observer.DidRemoveView(child)); |
| 3517 | 3548 |
| 3518 widget->RemoveRemovalsObserver(&removals_observer); | 3549 widget->RemoveRemovalsObserver(&removals_observer); |
| 3519 } | 3550 } |
| 3520 | 3551 |
| 3521 } // namespace test | 3552 } // namespace test |
| 3522 } // namespace views | 3553 } // namespace views |
| OLD | NEW |