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

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

Issue 574583002: Do not release capture when clicking to open select box (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 TestWindowObserver observer(window); 750 TestWindowObserver observer(window);
751 ui::test::EventGenerator generator(window->GetRootWindow(), tap_point); 751 ui::test::EventGenerator generator(window->GetRootWindow(), tap_point);
752 generator.GestureTapAt(tap_point); 752 generator.GestureTapAt(tap_point);
753 ASSERT_TRUE(parent_view_->HasFocus()); 753 ASSERT_TRUE(parent_view_->HasFocus());
754 ASSERT_TRUE(observer.destroyed()); 754 ASSERT_TRUE(observer.destroyed());
755 755
756 widget_host_ = NULL; 756 widget_host_ = NULL;
757 view_ = NULL; 757 view_ = NULL;
758 } 758 }
759 759
760 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
761
762 // On Desktop Linux, select boxes need mouse capture in order to work. Test that
763 // when a select box is opened via a mouse press that it retains mouse capture
764 // after the mouse is released.
765 TEST_F(RenderWidgetHostViewAuraTest, PopupRetainsCaptureAfterMouseRelease) {
766 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
767 parent_view_->Focus();
768 EXPECT_TRUE(parent_view_->HasFocus());
769
770 ui::test::EventGenerator generator(
771 parent_view_->GetNativeView()->GetRootWindow(), gfx::Point(300, 300));
772 generator.PressLeftButton();
773
774 view_->SetPopupType(blink::WebPopupTypeSelect);
775 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
776 ASSERT_TRUE(view_->NeedsMouseCapture());
777 aura::Window* window = view_->GetNativeView();
778 EXPECT_TRUE(window->HasCapture());
779
780 generator.ReleaseLeftButton();
781 EXPECT_TRUE(window->HasCapture());
782 }
783 #endif
784
760 // Checks that IME-composition-event state is maintained correctly. 785 // Checks that IME-composition-event state is maintained correctly.
761 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { 786 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
762 view_->InitAsChild(NULL); 787 view_->InitAsChild(NULL);
763 view_->Show(); 788 view_->Show();
764 789
765 ui::CompositionText composition_text; 790 ui::CompositionText composition_text;
766 composition_text.text = base::ASCIIToUTF16("|a|b"); 791 composition_text.text = base::ASCIIToUTF16("|a|b");
767 792
768 // Focused segment 793 // Focused segment
769 composition_text.underlines.push_back( 794 composition_text.underlines.push_back(
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); 2778 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode());
2754 2779
2755 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, 2780 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
2756 blink::WebGestureDeviceTouchscreen); 2781 blink::WebGestureDeviceTouchscreen);
2757 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); 2782 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode());
2758 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); 2783 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode());
2759 EXPECT_EQ(3U, sink_->message_count()); 2784 EXPECT_EQ(3U, sink_->message_count());
2760 } 2785 }
2761 2786
2762 } // namespace content 2787 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698