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

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

Issue 133073010: [Views] Cause the window controls to be reset independent of title update in the non-client view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 // |contents_view_| should no longer have focus. 937 // |contents_view_| should no longer have focus.
938 EXPECT_FALSE(contents_view->HasFocus()); 938 EXPECT_FALSE(contents_view->HasFocus());
939 EXPECT_TRUE(bubble_delegate_view->HasFocus()); 939 EXPECT_TRUE(bubble_delegate_view->HasFocus());
940 940
941 bubble_delegate_view->GetWidget()->CloseNow(); 941 bubble_delegate_view->GetWidget()->CloseNow();
942 942
943 // Closing the bubble should result in focus going back to the contents view. 943 // Closing the bubble should result in focus going back to the contents view.
944 EXPECT_TRUE(contents_view->HasFocus()); 944 EXPECT_TRUE(contents_view->HasFocus());
945 } 945 }
946 946
947 class TestBubbleDelegateView : public BubbleDelegateView {
948 public:
949 TestBubbleDelegateView(View* anchor)
950 : BubbleDelegateView(anchor, BubbleBorder::NONE),
951 reset_controls_called_(false) {}
952 virtual ~TestBubbleDelegateView() {}
953
954 virtual bool ShouldShowCloseButton() const OVERRIDE {
955 reset_controls_called_ = true;
956 return true;
957 }
958
959 mutable bool reset_controls_called_;
960 };
961
962 TEST_F(WidgetTest, BubbleControlsResetOnInit) {
963 Widget* anchor = CreateTopLevelPlatformWidget();
964 anchor->Show();
965
966 TestBubbleDelegateView* bubble_delegate =
967 new TestBubbleDelegateView(anchor->client_view());
968 Widget* bubble_widget(BubbleDelegateView::CreateBubble(bubble_delegate));
969 EXPECT_TRUE(bubble_delegate->reset_controls_called_);
970 bubble_widget->Show();
971 bubble_widget->CloseNow();
972
973 anchor->Hide();
974 anchor->CloseNow();
975 }
976
947 // Desktop native widget Aura tests are for non Chrome OS platforms. 977 // Desktop native widget Aura tests are for non Chrome OS platforms.
948 #if !defined(OS_CHROMEOS) 978 #if !defined(OS_CHROMEOS)
949 // Test to ensure that after minimize, view width is set to zero. 979 // Test to ensure that after minimize, view width is set to zero.
950 TEST_F(WidgetTest, TestViewWidthAfterMinimizingWidget) { 980 TEST_F(WidgetTest, TestViewWidthAfterMinimizingWidget) {
951 // Create a widget. 981 // Create a widget.
952 Widget widget; 982 Widget widget;
953 Widget::InitParams init_params = 983 Widget::InitParams init_params =
954 CreateParams(Widget::InitParams::TYPE_WINDOW); 984 CreateParams(Widget::InitParams::TYPE_WINDOW);
955 init_params.show_state = ui::SHOW_STATE_NORMAL; 985 init_params.show_state = ui::SHOW_STATE_NORMAL;
956 gfx::Rect initial_bounds(0, 0, 300, 400); 986 gfx::Rect initial_bounds(0, 0, 300, 400);
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 EXPECT_EQ(GetWidgetShowState(widget), ui::SHOW_STATE_NORMAL); 2315 EXPECT_EQ(GetWidgetShowState(widget), ui::SHOW_STATE_NORMAL);
2286 2316
2287 widget->CloseNow(); 2317 widget->CloseNow();
2288 widget2.CloseNow(); 2318 widget2.CloseNow();
2289 } 2319 }
2290 2320
2291 #endif 2321 #endif
2292 2322
2293 } // namespace test 2323 } // namespace test
2294 } // namespace views 2324 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698