OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "ui/aura/window_event_dispatcher.h" | 49 #include "ui/aura/window_event_dispatcher.h" |
50 #include "ui/aura/window_observer.h" | 50 #include "ui/aura/window_observer.h" |
51 #include "ui/base/ui_base_types.h" | 51 #include "ui/base/ui_base_types.h" |
52 #include "ui/compositor/compositor.h" | 52 #include "ui/compositor/compositor.h" |
53 #include "ui/compositor/test/draw_waiter_for_test.h" | 53 #include "ui/compositor/test/draw_waiter_for_test.h" |
54 #include "ui/events/event.h" | 54 #include "ui/events/event.h" |
55 #include "ui/events/event_utils.h" | 55 #include "ui/events/event_utils.h" |
56 #include "ui/events/gestures/gesture_configuration.h" | 56 #include "ui/events/gestures/gesture_configuration.h" |
57 #include "ui/events/test/event_generator.h" | 57 #include "ui/events/test/event_generator.h" |
58 #include "ui/wm/core/default_activation_client.h" | 58 #include "ui/wm/core/default_activation_client.h" |
| 59 #include "ui/wm/core/window_util.h" |
59 | 60 |
60 using testing::_; | 61 using testing::_; |
61 | 62 |
62 using blink::WebGestureEvent; | 63 using blink::WebGestureEvent; |
63 using blink::WebInputEvent; | 64 using blink::WebInputEvent; |
64 using blink::WebMouseEvent; | 65 using blink::WebMouseEvent; |
65 using blink::WebMouseWheelEvent; | 66 using blink::WebMouseWheelEvent; |
66 using blink::WebTouchEvent; | 67 using blink::WebTouchEvent; |
67 using blink::WebTouchPoint; | 68 using blink::WebTouchPoint; |
68 | 69 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); | 839 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); |
839 ASSERT_TRUE(view_->NeedsMouseCapture()); | 840 ASSERT_TRUE(view_->NeedsMouseCapture()); |
840 aura::Window* window = view_->GetNativeView(); | 841 aura::Window* window = view_->GetNativeView(); |
841 EXPECT_TRUE(window->HasCapture()); | 842 EXPECT_TRUE(window->HasCapture()); |
842 | 843 |
843 generator.ReleaseLeftButton(); | 844 generator.ReleaseLeftButton(); |
844 EXPECT_TRUE(window->HasCapture()); | 845 EXPECT_TRUE(window->HasCapture()); |
845 } | 846 } |
846 #endif | 847 #endif |
847 | 848 |
| 849 // Test that select boxes close when their parent window loses focus (e.g. due |
| 850 // to an alert or system modal dialog). |
| 851 TEST_F(RenderWidgetHostViewAuraTest, PopupClosesWhenParentLosesFocus) { |
| 852 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400)); |
| 853 parent_view_->Focus(); |
| 854 EXPECT_TRUE(parent_view_->HasFocus()); |
| 855 |
| 856 ui::test::EventGenerator generator( |
| 857 parent_view_->GetNativeView()->GetRootWindow(), gfx::Point(300, 300)); |
| 858 generator.PressLeftButton(); |
| 859 |
| 860 view_->SetPopupType(blink::WebPopupTypeSelect); |
| 861 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); |
| 862 |
| 863 aura::Window* popup_window = view_->GetNativeView(); |
| 864 TestWindowObserver observer(popup_window); |
| 865 |
| 866 aura::test::TestWindowDelegate delegate; |
| 867 scoped_ptr<aura::Window> dialog_window(new aura::Window(&delegate)); |
| 868 dialog_window->Init(aura::WINDOW_LAYER_TEXTURED); |
| 869 aura::client::ParentWindowWithContext( |
| 870 dialog_window.get(), popup_window, gfx::Rect()); |
| 871 dialog_window->Show(); |
| 872 wm::ActivateWindow(dialog_window.get()); |
| 873 |
| 874 ASSERT_TRUE(wm::IsActiveWindow(dialog_window.get())); |
| 875 EXPECT_TRUE(observer.destroyed()); |
| 876 } |
| 877 |
848 // Checks that IME-composition-event state is maintained correctly. | 878 // Checks that IME-composition-event state is maintained correctly. |
849 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { | 879 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { |
850 view_->InitAsChild(NULL); | 880 view_->InitAsChild(NULL); |
851 view_->Show(); | 881 view_->Show(); |
852 | 882 |
853 ui::CompositionText composition_text; | 883 ui::CompositionText composition_text; |
854 composition_text.text = base::ASCIIToUTF16("|a|b"); | 884 composition_text.text = base::ASCIIToUTF16("|a|b"); |
855 | 885 |
856 // Focused segment | 886 // Focused segment |
857 composition_text.underlines.push_back( | 887 composition_text.underlines.push_back( |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2907 } | 2937 } |
2908 | 2938 |
2909 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted | 2939 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted |
2910 // before RWH), we clean up properly and don't leak the RWHVGuest. | 2940 // before RWH), we clean up properly and don't leak the RWHVGuest. |
2911 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { | 2941 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { |
2912 TearDownEnvironment(); | 2942 TearDownEnvironment(); |
2913 ASSERT_FALSE(guest_view_weak_.get()); | 2943 ASSERT_FALSE(guest_view_weak_.get()); |
2914 } | 2944 } |
2915 | 2945 |
2916 } // namespace content | 2946 } // namespace content |
OLD | NEW |