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

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 659233002: STASH: Epic Experimental patch for toolkit-views App List on Mac Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fix a few things. Works@master Created 6 years, 2 months 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
OLDNEW
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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 child2->OnNativeWidgetMove(); 862 child2->OnNativeWidgetMove();
863 EXPECT_EQ(child2, widget_bounds_changed()); 863 EXPECT_EQ(child2, widget_bounds_changed());
864 864
865 child1->OnNativeWidgetSizeChanged(gfx::Size()); 865 child1->OnNativeWidgetSizeChanged(gfx::Size());
866 EXPECT_EQ(child1, widget_bounds_changed()); 866 EXPECT_EQ(child1, widget_bounds_changed());
867 867
868 child2->OnNativeWidgetSizeChanged(gfx::Size()); 868 child2->OnNativeWidgetSizeChanged(gfx::Size());
869 EXPECT_EQ(child2, widget_bounds_changed()); 869 EXPECT_EQ(child2, widget_bounds_changed());
870 } 870 }
871 871
872 // An extension to WidgetBoundsChanged to ensure notificaitons are forwarded
873 // by the NativeWidget implementation.
874 TEST_F(WidgetObserverTest, WidgetBoundsChangedNative) {
875 // Don't use NewWidget(), so that the Init() flow can be observed to ensure
876 // consistency across platforms.
877 Widget* widget = new Widget(); // Note: owned by NativeWidget.
878 widget->AddObserver(this);
879
880 EXPECT_FALSE(widget_bounds_changed());
881 widget->Init(Widget::InitParams());
882
883 EXPECT_TRUE(widget_bounds_changed());
884 reset();
885
886 widget->SetSize(gfx::Size(160, 100));
887 EXPECT_TRUE(widget_bounds_changed());
888 reset();
889
890 widget->Show();
891 EXPECT_TRUE(widget_bounds_changed());
892 reset();
893
894 widget->SetSize(gfx::Size(170, 100));
895 EXPECT_TRUE(widget_bounds_changed());
896 reset();
897
898 widget->CloseNow();
899 EXPECT_FALSE(widget_bounds_changed());
900 }
901
872 // Tests that SetBounds() and GetWindowBoundsInScreen() is symmetric when the 902 // Tests that SetBounds() and GetWindowBoundsInScreen() is symmetric when the
873 // widget is visible and not maximized or fullscreen. 903 // widget is visible and not maximized or fullscreen.
874 TEST_F(WidgetTest, GetWindowBoundsInScreen) { 904 TEST_F(WidgetTest, GetWindowBoundsInScreen) {
875 // Choose test coordinates away from edges and dimensions that are "small" 905 // Choose test coordinates away from edges and dimensions that are "small"
876 // (but not too small) to ensure the OS doesn't try to adjust them. 906 // (but not too small) to ensure the OS doesn't try to adjust them.
877 const gfx::Rect kTestBounds(150, 150, 400, 300); 907 const gfx::Rect kTestBounds(150, 150, 400, 300);
878 const gfx::Size kTestSize(200, 180); 908 const gfx::Size kTestSize(200, 180);
879 909
880 // First test a toplevel widget. 910 // First test a toplevel widget.
881 Widget* widget = CreateTopLevelPlatformWidget(); 911 Widget* widget = CreateTopLevelPlatformWidget();
(...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3370 3400
3371 EXPECT_EQ(test_rect, root_view->bounds()); 3401 EXPECT_EQ(test_rect, root_view->bounds());
3372 widget->ReorderNativeViews(); 3402 widget->ReorderNativeViews();
3373 EXPECT_EQ(test_rect, root_view->bounds()); 3403 EXPECT_EQ(test_rect, root_view->bounds());
3374 3404
3375 widget->CloseNow(); 3405 widget->CloseNow();
3376 } 3406 }
3377 3407
3378 } // namespace test 3408 } // namespace test
3379 } // namespace views 3409 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac_unittest.mm ('k') | ui/views_content_client/views_content_client_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698