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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 2583873002: Correctly update the popup window position (Closed)
Patch Set: test added Created 3 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
« no previous file with comments | « ui/aura/window.cc ('k') | ui/views/widget/desktop_aura/desktop_screen_position_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 ui::EF_NONE, ui::EF_NONE); 607 ui::EF_NONE, ui::EF_NONE);
608 details = GetEventProcessor(&top_level_widget)->OnEventFromSource( 608 details = GetEventProcessor(&top_level_widget)->OnEventFromSource(
609 &mouse_down_main); 609 &mouse_down_main);
610 ASSERT_FALSE(details.dispatcher_destroyed); 610 ASSERT_FALSE(details.dispatcher_destroyed);
611 EXPECT_EQ(0, widget_view->GetEventCount(ui::ET_MOUSE_MOVED)); 611 EXPECT_EQ(0, widget_view->GetEventCount(ui::ET_MOUSE_MOVED));
612 612
613 modal_dialog_widget->CloseNow(); 613 modal_dialog_widget->CloseNow();
614 top_level_widget.CloseNow(); 614 top_level_widget.CloseNow();
615 } 615 }
616 616
617 TEST_F(WidgetTest, SetScreenBoundsOnNativeWindow) {
618 Widget widget;
619 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
620 params.native_widget =
621 CreatePlatformDesktopNativeWidgetImpl(params, &widget, nullptr);
622 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
623 params.bounds = gfx::Rect(10, 10, 100, 100);
624 widget.Init(params);
625 widget.Show();
626 aura::Window* window = widget.GetNativeWindow();
627 display::Screen* screen = display::Screen::GetScreen();
628
629 const gfx::Rect new_screen_bounds(50, 50, 150, 150);
630 window->SetBoundsInScreen(new_screen_bounds,
631 screen->GetPrimaryDisplay());
632 EXPECT_EQ(new_screen_bounds, widget.GetWindowBoundsInScreen());
633 widget.CloseNow();
634 }
635
617 #if defined(OS_WIN) 636 #if defined(OS_WIN)
618 // Tests whether we can activate the top level widget when a modal dialog is 637 // Tests whether we can activate the top level widget when a modal dialog is
619 // active. 638 // active.
620 // Flaky: crbug.com/613428 639 // Flaky: crbug.com/613428
621 TEST_F(WidgetTest, DISABLED_WindowModalityActivationTest) { 640 TEST_F(WidgetTest, DISABLED_WindowModalityActivationTest) {
622 TestDesktopWidgetDelegate widget_delegate; 641 TestDesktopWidgetDelegate widget_delegate;
623 widget_delegate.InitWidget(CreateParams(Widget::InitParams::TYPE_WINDOW)); 642 widget_delegate.InitWidget(CreateParams(Widget::InitParams::TYPE_WINDOW));
624 643
625 Widget* top_level_widget = widget_delegate.GetWidget(); 644 Widget* top_level_widget = widget_delegate.GetWidget();
626 top_level_widget->Show(); 645 top_level_widget->Show();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); 693 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled);
675 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); 694 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled);
676 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); 695 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled);
677 widget.CloseNow(); 696 widget.CloseNow();
678 } 697 }
679 698
680 #endif // defined(OS_WIN) 699 #endif // defined(OS_WIN)
681 700
682 } // namespace test 701 } // namespace test
683 } // namespace views 702 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/views/widget/desktop_aura/desktop_screen_position_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698