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

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 2455143003: Fix mouse wheel events processing. (Closed)
Patch Set: Fix review issues. Created 4 years, 1 month 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
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 #include <memory> 6 #include <memory>
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 EXPECT_FALSE(removals_observer.DidRemoveView(child)); 3620 EXPECT_FALSE(removals_observer.DidRemoveView(child));
3621 3621
3622 // Moving the child to a different widget should call the removals observer. 3622 // Moving the child to a different widget should call the removals observer.
3623 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget()); 3623 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget());
3624 widget2->client_view()->AddChildView(child); 3624 widget2->client_view()->AddChildView(child);
3625 EXPECT_TRUE(removals_observer.DidRemoveView(child)); 3625 EXPECT_TRUE(removals_observer.DidRemoveView(child));
3626 3626
3627 widget->RemoveRemovalsObserver(&removals_observer); 3627 widget->RemoveRemovalsObserver(&removals_observer);
3628 } 3628 }
3629 3629
3630 // Test dispatch of ui::ET_MOUSEWHEEL.
3631 TEST_F(WidgetTest, MouseWheelEvent) {
3632 WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget());
3633 widget->SetBounds(gfx::Rect(0, 0, 600, 600));
3634 EventCountView* event_count_view = new EventCountView();
3635 widget->GetContentsView()->AddChildView(event_count_view);
3636 event_count_view->SetBounds(0, 0, 600, 600);
3637 widget->Show();
3638
3639 ui::test::EventGenerator event_generator(GetContext(),
3640 widget->GetNativeWindow());
3641
3642 event_generator.MoveMouseWheel(1, 1);
3643 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSEWHEEL));
3644 }
3645
3630 #if defined(OS_WIN) 3646 #if defined(OS_WIN)
3631 3647
3632 namespace { 3648 namespace {
3633 3649
3634 // Provides functionality to create a window modal dialog. 3650 // Provides functionality to create a window modal dialog.
3635 class ModalDialogDelegate : public DialogDelegateView { 3651 class ModalDialogDelegate : public DialogDelegateView {
3636 public: 3652 public:
3637 explicit ModalDialogDelegate(ui::ModalType type) : type_(type) {} 3653 explicit ModalDialogDelegate(ui::ModalType type) : type_(type) {}
3638 ~ModalDialogDelegate() override {} 3654 ~ModalDialogDelegate() override {}
3639 3655
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3827 Transparency_DesktopWidgetTranslucent 3843 Transparency_DesktopWidgetTranslucent
3828 #endif 3844 #endif
3829 TEST_F(CompositingWidgetTest, MAYBE_Transparency_DesktopWidgetTranslucent) { 3845 TEST_F(CompositingWidgetTest, MAYBE_Transparency_DesktopWidgetTranslucent) {
3830 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW); 3846 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW);
3831 } 3847 }
3832 3848
3833 #endif // !defined(OS_CHROMEOS) 3849 #endif // !defined(OS_CHROMEOS)
3834 3850
3835 } // namespace test 3851 } // namespace test
3836 } // namespace views 3852 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698