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" | |
60 | 59 |
61 using testing::_; | 60 using testing::_; |
62 | 61 |
63 using blink::WebGestureEvent; | 62 using blink::WebGestureEvent; |
64 using blink::WebInputEvent; | 63 using blink::WebInputEvent; |
65 using blink::WebMouseEvent; | 64 using blink::WebMouseEvent; |
66 using blink::WebMouseWheelEvent; | 65 using blink::WebMouseWheelEvent; |
67 using blink::WebTouchEvent; | 66 using blink::WebTouchEvent; |
68 using blink::WebTouchPoint; | 67 using blink::WebTouchPoint; |
69 | 68 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); | 838 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); |
840 ASSERT_TRUE(view_->NeedsMouseCapture()); | 839 ASSERT_TRUE(view_->NeedsMouseCapture()); |
841 aura::Window* window = view_->GetNativeView(); | 840 aura::Window* window = view_->GetNativeView(); |
842 EXPECT_TRUE(window->HasCapture()); | 841 EXPECT_TRUE(window->HasCapture()); |
843 | 842 |
844 generator.ReleaseLeftButton(); | 843 generator.ReleaseLeftButton(); |
845 EXPECT_TRUE(window->HasCapture()); | 844 EXPECT_TRUE(window->HasCapture()); |
846 } | 845 } |
847 #endif | 846 #endif |
848 | 847 |
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 | |
878 // Checks that IME-composition-event state is maintained correctly. | 848 // Checks that IME-composition-event state is maintained correctly. |
879 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { | 849 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { |
880 view_->InitAsChild(NULL); | 850 view_->InitAsChild(NULL); |
881 view_->Show(); | 851 view_->Show(); |
882 | 852 |
883 ui::CompositionText composition_text; | 853 ui::CompositionText composition_text; |
884 composition_text.text = base::ASCIIToUTF16("|a|b"); | 854 composition_text.text = base::ASCIIToUTF16("|a|b"); |
885 | 855 |
886 // Focused segment | 856 // Focused segment |
887 composition_text.underlines.push_back( | 857 composition_text.underlines.push_back( |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2937 } | 2907 } |
2938 | 2908 |
2939 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted | 2909 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted |
2940 // before RWH), we clean up properly and don't leak the RWHVGuest. | 2910 // before RWH), we clean up properly and don't leak the RWHVGuest. |
2941 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { | 2911 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { |
2942 TearDownEnvironment(); | 2912 TearDownEnvironment(); |
2943 ASSERT_FALSE(guest_view_weak_.get()); | 2913 ASSERT_FALSE(guest_view_weak_.get()); |
2944 } | 2914 } |
2945 | 2915 |
2946 } // namespace content | 2916 } // namespace content |
OLD | NEW |