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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 749 |
750 anchor->Hide(); | 750 anchor->Hide(); |
751 anchor->CloseNow(); | 751 anchor->CloseNow(); |
752 } | 752 } |
753 | 753 |
754 #if !defined(USE_AURA) && defined(OS_WIN) | 754 #if !defined(USE_AURA) && defined(OS_WIN) |
755 // Aura needs shell to maximize/fullscreen window. | 755 // Aura needs shell to maximize/fullscreen window. |
756 // NativeWidgetGtk doesn't implement GetRestoredBounds. | 756 // NativeWidgetGtk doesn't implement GetRestoredBounds. |
757 TEST_F(WidgetTest, GetRestoredBounds) { | 757 TEST_F(WidgetTest, GetRestoredBounds) { |
758 Widget* toplevel = CreateTopLevelPlatformWidget(); | 758 Widget* toplevel = CreateTopLevelPlatformWidget(); |
759 EXPECT_EQ(toplevel->GetWindowScreenBounds().ToString(), | 759 EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), |
760 toplevel->GetRestoredBounds().ToString()); | 760 toplevel->GetRestoredBounds().ToString()); |
761 toplevel->Show(); | 761 toplevel->Show(); |
762 toplevel->Maximize(); | 762 toplevel->Maximize(); |
763 RunPendingMessages(); | 763 RunPendingMessages(); |
764 EXPECT_NE(toplevel->GetWindowScreenBounds().ToString(), | 764 EXPECT_NE(toplevel->GetWindowBoundsInScreen().ToString(), |
765 toplevel->GetRestoredBounds().ToString()); | 765 toplevel->GetRestoredBounds().ToString()); |
766 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); | 766 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); |
767 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); | 767 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); |
768 | 768 |
769 toplevel->Restore(); | 769 toplevel->Restore(); |
770 RunPendingMessages(); | 770 RunPendingMessages(); |
771 EXPECT_EQ(toplevel->GetWindowScreenBounds().ToString(), | 771 EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), |
772 toplevel->GetRestoredBounds().ToString()); | 772 toplevel->GetRestoredBounds().ToString()); |
773 | 773 |
774 toplevel->SetFullscreen(true); | 774 toplevel->SetFullscreen(true); |
775 RunPendingMessages(); | 775 RunPendingMessages(); |
776 EXPECT_NE(toplevel->GetWindowScreenBounds().ToString(), | 776 EXPECT_NE(toplevel->GetWindowBoundsInScreen().ToString(), |
777 toplevel->GetRestoredBounds().ToString()); | 777 toplevel->GetRestoredBounds().ToString()); |
778 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); | 778 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); |
779 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); | 779 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); |
780 } | 780 } |
781 #endif | 781 #endif |
782 | 782 |
783 // Test that window state is not changed after getting out of full screen. | 783 // Test that window state is not changed after getting out of full screen. |
784 TEST_F(WidgetTest, ExitFullscreenRestoreState) { | 784 TEST_F(WidgetTest, ExitFullscreenRestoreState) { |
785 Widget* toplevel = CreateTopLevelPlatformWidget(); | 785 Widget* toplevel = CreateTopLevelPlatformWidget(); |
786 | 786 |
(...skipping 28 matching lines...) Expand all Loading... |
815 // And it stays maximized after getting out of full screen. | 815 // And it stays maximized after getting out of full screen. |
816 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, GetWidgetShowState(toplevel)); | 816 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, GetWidgetShowState(toplevel)); |
817 | 817 |
818 // Clean up. | 818 // Clean up. |
819 toplevel->Close(); | 819 toplevel->Close(); |
820 RunPendingMessages(); | 820 RunPendingMessages(); |
821 } | 821 } |
822 | 822 |
823 } // namespace | 823 } // namespace |
824 } // namespace views | 824 } // namespace views |
OLD | NEW |