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

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

Issue 406413004: Cleanups for aura/test/event_generator.h (resolve TODOs) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for added files Created 6 years, 5 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 | Annotate | Revision Log
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 21 matching lines...) Expand all
32 #include "content/public/test/test_browser_context.h" 32 #include "content/public/test/test_browser_context.h"
33 #include "ipc/ipc_test_sink.h" 33 #include "ipc/ipc_test_sink.h"
34 #include "testing/gmock/include/gmock/gmock.h" 34 #include "testing/gmock/include/gmock/gmock.h"
35 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
36 #include "ui/aura/client/aura_constants.h" 36 #include "ui/aura/client/aura_constants.h"
37 #include "ui/aura/client/screen_position_client.h" 37 #include "ui/aura/client/screen_position_client.h"
38 #include "ui/aura/client/window_tree_client.h" 38 #include "ui/aura/client/window_tree_client.h"
39 #include "ui/aura/env.h" 39 #include "ui/aura/env.h"
40 #include "ui/aura/layout_manager.h" 40 #include "ui/aura/layout_manager.h"
41 #include "ui/aura/test/aura_test_helper.h" 41 #include "ui/aura/test/aura_test_helper.h"
42 #include "ui/aura/test/event_generator.h"
43 #include "ui/aura/test/test_cursor_client.h" 42 #include "ui/aura/test/test_cursor_client.h"
44 #include "ui/aura/test/test_screen.h" 43 #include "ui/aura/test/test_screen.h"
45 #include "ui/aura/test/test_window_delegate.h" 44 #include "ui/aura/test/test_window_delegate.h"
46 #include "ui/aura/window.h" 45 #include "ui/aura/window.h"
47 #include "ui/aura/window_event_dispatcher.h" 46 #include "ui/aura/window_event_dispatcher.h"
48 #include "ui/aura/window_observer.h" 47 #include "ui/aura/window_observer.h"
49 #include "ui/base/ui_base_types.h" 48 #include "ui/base/ui_base_types.h"
50 #include "ui/compositor/compositor.h" 49 #include "ui/compositor/compositor.h"
51 #include "ui/compositor/test/draw_waiter_for_test.h" 50 #include "ui/compositor/test/draw_waiter_for_test.h"
52 #include "ui/events/event.h" 51 #include "ui/events/event.h"
53 #include "ui/events/event_utils.h" 52 #include "ui/events/event_utils.h"
54 #include "ui/events/gestures/gesture_configuration.h" 53 #include "ui/events/gestures/gesture_configuration.h"
54 #include "ui/events/test/event_generator.h"
55 #include "ui/wm/core/default_activation_client.h" 55 #include "ui/wm/core/default_activation_client.h"
56 56
57 using testing::_; 57 using testing::_;
58 58
59 using blink::WebGestureEvent; 59 using blink::WebGestureEvent;
60 using blink::WebInputEvent; 60 using blink::WebInputEvent;
61 using blink::WebMouseEvent; 61 using blink::WebMouseEvent;
62 using blink::WebMouseWheelEvent; 62 using blink::WebMouseWheelEvent;
63 using blink::WebTouchEvent; 63 using blink::WebTouchEvent;
64 using blink::WebTouchPoint; 64 using blink::WebTouchPoint;
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); 708 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
709 aura::Window* window = view_->GetNativeView(); 709 aura::Window* window = view_->GetNativeView();
710 ASSERT_TRUE(window != NULL); 710 ASSERT_TRUE(window != NULL);
711 711
712 gfx::Point click_point; 712 gfx::Point click_point;
713 EXPECT_FALSE(window->GetBoundsInRootWindow().Contains(click_point)); 713 EXPECT_FALSE(window->GetBoundsInRootWindow().Contains(click_point));
714 aura::Window* parent_window = parent_view_->GetNativeView(); 714 aura::Window* parent_window = parent_view_->GetNativeView();
715 EXPECT_FALSE(parent_window->GetBoundsInRootWindow().Contains(click_point)); 715 EXPECT_FALSE(parent_window->GetBoundsInRootWindow().Contains(click_point));
716 716
717 TestWindowObserver observer(window); 717 TestWindowObserver observer(window);
718 aura::test::EventGenerator generator(window->GetRootWindow(), click_point); 718 ui::test::EventGenerator generator(window->GetRootWindow(), click_point);
719 generator.ClickLeftButton(); 719 generator.ClickLeftButton();
720 ASSERT_TRUE(parent_view_->HasFocus()); 720 ASSERT_TRUE(parent_view_->HasFocus());
721 ASSERT_TRUE(observer.destroyed()); 721 ASSERT_TRUE(observer.destroyed());
722 722
723 widget_host_ = NULL; 723 widget_host_ = NULL;
724 view_ = NULL; 724 view_ = NULL;
725 } 725 }
726 726
727 // Checks that a popup view is destroyed when a user taps outside of the popup 727 // Checks that a popup view is destroyed when a user taps outside of the popup
728 // view and focus does not change. This is the case when the user taps the 728 // view and focus does not change. This is the case when the user taps the
729 // desktop background on Chrome OS. 729 // desktop background on Chrome OS.
730 TEST_F(RenderWidgetHostViewAuraTest, DestroyPopupTapOutsidePopup) { 730 TEST_F(RenderWidgetHostViewAuraTest, DestroyPopupTapOutsidePopup) {
731 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400)); 731 parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
732 parent_view_->Focus(); 732 parent_view_->Focus();
733 EXPECT_TRUE(parent_view_->HasFocus()); 733 EXPECT_TRUE(parent_view_->HasFocus());
734 734
735 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100)); 735 view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
736 aura::Window* window = view_->GetNativeView(); 736 aura::Window* window = view_->GetNativeView();
737 ASSERT_TRUE(window != NULL); 737 ASSERT_TRUE(window != NULL);
738 738
739 gfx::Point tap_point; 739 gfx::Point tap_point;
740 EXPECT_FALSE(window->GetBoundsInRootWindow().Contains(tap_point)); 740 EXPECT_FALSE(window->GetBoundsInRootWindow().Contains(tap_point));
741 aura::Window* parent_window = parent_view_->GetNativeView(); 741 aura::Window* parent_window = parent_view_->GetNativeView();
742 EXPECT_FALSE(parent_window->GetBoundsInRootWindow().Contains(tap_point)); 742 EXPECT_FALSE(parent_window->GetBoundsInRootWindow().Contains(tap_point));
743 743
744 TestWindowObserver observer(window); 744 TestWindowObserver observer(window);
745 aura::test::EventGenerator generator(window->GetRootWindow(), tap_point); 745 ui::test::EventGenerator generator(window->GetRootWindow(), tap_point);
746 generator.GestureTapAt(tap_point); 746 generator.GestureTapAt(tap_point);
747 ASSERT_TRUE(parent_view_->HasFocus()); 747 ASSERT_TRUE(parent_view_->HasFocus());
748 ASSERT_TRUE(observer.destroyed()); 748 ASSERT_TRUE(observer.destroyed());
749 749
750 widget_host_ = NULL; 750 widget_host_ = NULL;
751 view_ = NULL; 751 view_ = NULL;
752 } 752 }
753 753
754 // Checks that IME-composition-event state is maintained correctly. 754 // Checks that IME-composition-event state is maintained correctly.
755 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { 755 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); 2677 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode());
2678 2678
2679 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, 2679 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
2680 blink::WebGestureDeviceTouchscreen); 2680 blink::WebGestureDeviceTouchscreen);
2681 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); 2681 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode());
2682 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); 2682 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode());
2683 EXPECT_EQ(3U, sink_->message_count()); 2683 EXPECT_EQ(3U, sink_->message_count());
2684 } 2684 }
2685 2685
2686 } // namespace content 2686 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698