blob: d5dcfbe94fa186841d10aa952102550c90d7f15a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_TEST_CAPTURE_TRACKING_VIEW_
#define UI_VIEWS_TEST_CAPTURE_TRACKING_VIEW_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/views/view.h"
namespace views {
namespace test {
// Used to track OnMousePressed() and OnMouseCaptureLost().
class CaptureTrackingView : public views::View {
public:
CaptureTrackingView();
~CaptureTrackingView() override;
// Returns true if OnMousePressed() has been invoked.
bool got_press() const { return got_press_; }
// Returns true if OnMouseCaptureLost() has been invoked.
bool got_capture_lost() const { return got_capture_lost_; }
void reset() { got_press_ = got_capture_lost_ = false; }
// Overridden from views::View
bool OnMousePressed(const ui::MouseEvent& event) override;
void OnMouseCaptureLost() override;
private:
// See description above getters.
bool got_press_;
bool got_capture_lost_;
DISALLOW_COPY_AND_ASSIGN(CaptureTrackingView);
};
} // namespace test
} // namespace views
#endif // UI_VIEWS_TEST_CAPTURE_TRACKING_VIEW_
|