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

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

Issue 12897004: Remove BubbleDelegateView::Show(); call GetWidget()->Show() instead; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixup more BubbleDelegateView::Show() calls. Created 7 years, 9 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/touchui/touch_editing_menu.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 "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 "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/events/event_utils.h" 10 #include "ui/base/events/event_utils.h"
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 widget.SetContentsView(contents_view); 1189 widget.SetContentsView(contents_view);
1190 widget.Show(); 1190 widget.Show();
1191 widget.Activate(); 1191 widget.Activate();
1192 contents_view->RequestFocus(); 1192 contents_view->RequestFocus();
1193 EXPECT_TRUE(contents_view->HasFocus()); 1193 EXPECT_TRUE(contents_view->HasFocus());
1194 1194
1195 // Show a bubble. 1195 // Show a bubble.
1196 BubbleDelegateView* bubble_delegate_view = 1196 BubbleDelegateView* bubble_delegate_view =
1197 new BubbleDelegateView(contents_view, BubbleBorder::TOP_LEFT); 1197 new BubbleDelegateView(contents_view, BubbleBorder::TOP_LEFT);
1198 bubble_delegate_view->set_focusable(true); 1198 bubble_delegate_view->set_focusable(true);
1199 Widget* bubble_widget = 1199 BubbleDelegateView::CreateBubble(bubble_delegate_view)->Show();
1200 BubbleDelegateView::CreateBubble(bubble_delegate_view);
1201 bubble_delegate_view->Show();
1202 bubble_delegate_view->RequestFocus(); 1200 bubble_delegate_view->RequestFocus();
1203 1201
1204 // |contents_view_| should no longer have focus. 1202 // |contents_view_| should no longer have focus.
1205 EXPECT_FALSE(contents_view->HasFocus()); 1203 EXPECT_FALSE(contents_view->HasFocus());
1206 EXPECT_TRUE(bubble_delegate_view->HasFocus()); 1204 EXPECT_TRUE(bubble_delegate_view->HasFocus());
1207 1205
1208 bubble_widget->CloseNow(); 1206 bubble_delegate_view->GetWidget()->CloseNow();
1209 1207
1210 // Closing the bubble should result in focus going back to the contents view. 1208 // Closing the bubble should result in focus going back to the contents view.
1211 EXPECT_TRUE(contents_view->HasFocus()); 1209 EXPECT_TRUE(contents_view->HasFocus());
1212 } 1210 }
1213 1211
1214 // Desktop native widget Aura tests are for non Chrome OS platforms. 1212 // Desktop native widget Aura tests are for non Chrome OS platforms.
1215 #if !defined(OS_CHROMEOS) 1213 #if !defined(OS_CHROMEOS)
1216 // This class validates whether paints are received for a visible Widget. 1214 // This class validates whether paints are received for a visible Widget.
1217 // To achieve this it overrides the Show and Close methods on the Widget class 1215 // To achieve this it overrides the Show and Close methods on the Widget class
1218 // and sets state whether subsequent paints are expected. 1216 // and sets state whether subsequent paints are expected.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 Widget::InitParams params = 1607 Widget::InitParams params =
1610 CreateParams(views::Widget::InitParams::TYPE_POPUP); 1608 CreateParams(views::Widget::InitParams::TYPE_POPUP);
1611 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 1609 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
1612 widget->Init(params); 1610 widget->Init(params);
1613 EXPECT_TRUE(delegate->on_before_init_called()); 1611 EXPECT_TRUE(delegate->on_before_init_called());
1614 EXPECT_TRUE(delegate->is_top_level()); 1612 EXPECT_TRUE(delegate->is_top_level());
1615 } 1613 }
1616 1614
1617 } // namespace 1615 } // namespace
1618 } // namespace views 1616 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/touchui/touch_editing_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698