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

Side by Side Diff: ui/views/test/test_views.h

Issue 1254963010: [Views] Move modality tests from widget_unittest.cc to desktop_native_widget_aura_unittest.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 4 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
« no previous file with comments | « no previous file | ui/views/test/test_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef UI_VIEWS_TEST_TEST_VIEWS_H_ 5 #ifndef UI_VIEWS_TEST_TEST_VIEWS_H_
6 #define UI_VIEWS_TEST_TEST_VIEWS_H_ 6 #define UI_VIEWS_TEST_TEST_VIEWS_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // ui::EventHandler override: 69 // ui::EventHandler override:
70 void OnEvent(ui::Event* event) override; 70 void OnEvent(ui::Event* event) override;
71 71
72 private: 72 private:
73 const ui::EventType event_type_; 73 const ui::EventType event_type_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(CloseWidgetView); 75 DISALLOW_COPY_AND_ASSIGN(CloseWidgetView);
76 }; 76 };
77 77
78 // A view that keeps track of the events it receives, optionally consuming them.
79 class EventCountView : public View {
80 public:
81 // Whether to call SetHandled() on events as they are received. For some event
82 // types, this will allow EventCountView to receives future events in the
83 // event sequence, such as a drag.
84 enum HandleMode { PROPAGATE_EVENTS, CONSUME_EVENTS };
85
86 EventCountView();
87 ~EventCountView() override;
88
89 int GetEventCount(ui::EventType type);
90 void ResetCounts();
91
92 int last_flags() const { return last_flags_; }
93
94 void set_handle_mode(HandleMode handle_mode) { handle_mode_ = handle_mode; }
95
96 protected:
97 // Overridden from View:
98 void OnMouseMoved(const ui::MouseEvent& event) override;
99
100 // Overridden from ui::EventHandler:
101 void OnKeyEvent(ui::KeyEvent* event) override;
102 void OnMouseEvent(ui::MouseEvent* event) override;
103 void OnScrollEvent(ui::ScrollEvent* event) override;
104 void OnGestureEvent(ui::GestureEvent* event) override;
105
106 private:
107 void RecordEvent(ui::Event* event);
108
109 std::map<ui::EventType, int> event_count_;
110 int last_flags_;
111 HandleMode handle_mode_;
112
113 DISALLOW_COPY_AND_ASSIGN(EventCountView);
114 };
115
78 } // namespace views 116 } // namespace views
79 117
80 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_ 118 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/test/test_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698