Automated Commit: Committing new LKGM version 7479.0.0 for chromeos.
[chromium-blink-merge.git] / ui / views / test / capture_tracking_view.h
blobacbc30561e6dbc95b8d88eb6d97ee27b76a56e1a
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_TEST_CAPTURE_TRACKING_VIEW_
6 #define UI_VIEWS_TEST_CAPTURE_TRACKING_VIEW_
8 #include "base/compiler_specific.h"
9 #include "ui/views/view.h"
11 namespace views {
12 namespace test {
14 // Used to track OnMousePressed() and OnMouseCaptureLost().
15 class CaptureTrackingView : public views::View {
16 public:
17 CaptureTrackingView();
18 ~CaptureTrackingView() override;
20 // Returns true if OnMousePressed() has been invoked.
21 bool got_press() const { return got_press_; }
23 // Returns true if OnMouseCaptureLost() has been invoked.
24 bool got_capture_lost() const { return got_capture_lost_; }
26 void reset() { got_press_ = got_capture_lost_ = false; }
28 // Overridden from views::View
29 bool OnMousePressed(const ui::MouseEvent& event) override;
30 void OnMouseCaptureLost() override;
32 private:
33 // See description above getters.
34 bool got_press_;
35 bool got_capture_lost_;
37 DISALLOW_COPY_AND_ASSIGN(CaptureTrackingView);
40 } // namespace test
41 } // namespace views
43 #endif // UI_VIEWS_TEST_CAPTURE_TRACKING_VIEW_