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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 784883002: Removes the old <select> popup code Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 "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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 TestWindowObserver observer(window); 785 TestWindowObserver observer(window);
786 ui::test::EventGenerator generator(window->GetRootWindow(), tap_point); 786 ui::test::EventGenerator generator(window->GetRootWindow(), tap_point);
787 generator.GestureTapAt(tap_point); 787 generator.GestureTapAt(tap_point);
788 ASSERT_TRUE(parent_view_->HasFocus()); 788 ASSERT_TRUE(parent_view_->HasFocus());
789 ASSERT_TRUE(observer.destroyed()); 789 ASSERT_TRUE(observer.destroyed());
790 790
791 widget_host_ = NULL; 791 widget_host_ = NULL;
792 view_ = NULL; 792 view_ = NULL;
793 } 793 }
794 794
795 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
796
797 // On Desktop Linux, select boxes need mouse capture in order to work. Test that
798 // when a select box is opened via a mouse press that it retains mouse capture
799 // after the mouse is released.
800 TEST_F(RenderWidgetHostViewAuraTest, PopupRetainsCaptureAfterMouseRelease) {
801 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
802 parent_view_->Focus();
803 EXPECT_TRUE(parent_view_->HasFocus());
804
805 ui::test::EventGenerator generator(
806 parent_view_->GetNativeView()->GetRootWindow(), gfx::Point(300, 300));
807 generator.PressLeftButton();
808
809 view_->SetPopupType(blink::WebPopupTypeSelect);
810 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
811 ASSERT_TRUE(view_->NeedsMouseCapture());
812 aura::Window* window = view_->GetNativeView();
813 EXPECT_TRUE(window->HasCapture());
814
815 generator.ReleaseLeftButton();
816 EXPECT_TRUE(window->HasCapture());
817 }
818 #endif
819
820 // Test that select boxes close when their parent window loses focus (e.g. due 795 // Test that select boxes close when their parent window loses focus (e.g. due
821 // to an alert or system modal dialog). 796 // to an alert or system modal dialog).
822 TEST_F(RenderWidgetHostViewAuraTest, PopupClosesWhenParentLosesFocus) { 797 TEST_F(RenderWidgetHostViewAuraTest, PopupClosesWhenParentLosesFocus) {
823 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400)); 798 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
824 parent_view_->Focus(); 799 parent_view_->Focus();
825 EXPECT_TRUE(parent_view_->HasFocus()); 800 EXPECT_TRUE(parent_view_->HasFocus());
826 801
827 view_->SetPopupType(blink::WebPopupTypeSelect); 802 view_->SetPopupType(blink::WebPopupTypeSelect);
828 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); 803 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
829 804
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 } 2912 }
2938 2913
2939 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted 2914 // 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. 2915 // before RWH), we clean up properly and don't leak the RWHVGuest.
2941 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { 2916 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) {
2942 TearDownEnvironment(); 2917 TearDownEnvironment();
2943 ASSERT_FALSE(guest_view_weak_.get()); 2918 ASSERT_FALSE(guest_view_weak_.get());
2944 } 2919 }
2945 2920
2946 } // namespace content 2921 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/child/blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698