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

Unified Diff: views/view_unittest.cc

Issue 8052019: Create constrained windows in a hidden state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and address comments Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/view.cc ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/view_unittest.cc
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index a9f78590798a0cd408187f0310368661110f099a..52780f548015eb8aa44ada36f14f239a41f31086 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -985,6 +985,7 @@ TEST_F(ViewTest, ActivateAccelerator) {
widget->Init(params);
View* root = widget->GetRootView();
root->AddChildView(view);
+ widget->Show();
// Get the focus manager.
FocusManager* focus_manager = widget->GetFocusManager();
@@ -1049,6 +1050,7 @@ TEST_F(ViewTest, HiddenViewWithAccelerator) {
widget->Init(params);
View* root = widget->GetRootView();
root->AddChildView(view);
+ widget->Show();
FocusManager* focus_manager = widget->GetFocusManager();
ASSERT_TRUE(focus_manager);
@@ -1066,6 +1068,40 @@ TEST_F(ViewTest, HiddenViewWithAccelerator) {
#endif
#if defined(OS_WIN) && !defined(USE_AURA)
+TEST_F(ViewTest, ViewInHiddenWidgetWithAccelerator) {
+ Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false);
+ TestView* view = new TestView();
+ view->Reset();
+ view->AddAccelerator(return_accelerator);
+ EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 0);
+
+ scoped_ptr<Widget> widget(new Widget);
+ Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
+ params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.bounds = gfx::Rect(0, 0, 100, 100);
+ widget->Init(params);
+ View* root = widget->GetRootView();
+ root->AddChildView(view);
+
+ FocusManager* focus_manager = widget->GetFocusManager();
+ ASSERT_TRUE(focus_manager);
+
+ EXPECT_EQ(NULL,
+ focus_manager->GetCurrentTargetForAccelerator(return_accelerator));
+
+ widget->Show();
+ EXPECT_EQ(view,
+ focus_manager->GetCurrentTargetForAccelerator(return_accelerator));
+
+ widget->Hide();
+ EXPECT_EQ(NULL,
+ focus_manager->GetCurrentTargetForAccelerator(return_accelerator));
+
+ widget->CloseNow();
+}
+#endif
+
+#if defined(OS_WIN) && !defined(USE_AURA)
////////////////////////////////////////////////////////////////////////////////
// Mouse-wheel message rerouting
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « views/view.cc ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698