summaryrefslogtreecommitdiffstats
path: root/components/mus/public/cpp/tests
diff options
context:
space:
mode:
authorjonross <jonross@chromium.org>2016-03-08 06:03:26 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-08 14:04:36 +0000
commitc3385cc179280dd4b09733b2954be7e9ae3b5112 (patch)
treefcb8a119477033e1e18f3b8ca5b4bd0b0445b7ea /components/mus/public/cpp/tests
parent1d3dd7dbbeea929087e089ae1e8acdaa4fae80aa (diff)
downloadchromium_src-c3385cc179280dd4b09733b2954be7e9ae3b5112.zip
chromium_src-c3385cc179280dd4b09733b2954be7e9ae3b5112.tar.gz
chromium_src-c3385cc179280dd4b09733b2954be7e9ae3b5112.tar.bz2
Update WindowTree::OnWindowInputEventAck to include handled
To support post-target accelerators we plan to have the client application report whether an input event was handled or not, when ack-ing the event. This change updates WindowTree::OnWindowInputEventAck to include a boolean parameter |handled|. PlatformWindowMus will always mark events as handled. CompositorMusConnection will base the handled state on the ack state of the renderer. TEST=WindowTreeClientImplTest, WindowTreeApptest, WindowTreeTest, CompositorMusConnectionTest BUG=560478 Review URL: https://codereview.chromium.org/1749323002 Cr-Commit-Position: refs/heads/master@{#379821}
Diffstat (limited to 'components/mus/public/cpp/tests')
-rw-r--r--components/mus/public/cpp/tests/test_window_tree.cc2
-rw-r--r--components/mus/public/cpp/tests/test_window_tree.h2
-rw-r--r--components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc21
3 files changed, 16 insertions, 9 deletions
diff --git a/components/mus/public/cpp/tests/test_window_tree.cc b/components/mus/public/cpp/tests/test_window_tree.cc
index 398a661..7301bd9 100644
--- a/components/mus/public/cpp/tests/test_window_tree.cc
+++ b/components/mus/public/cpp/tests/test_window_tree.cc
@@ -132,7 +132,7 @@ void TestWindowTree::SetImeVisibility(uint32_t window_id,
bool visible,
mojo::TextInputStatePtr state) {}
-void TestWindowTree::OnWindowInputEventAck(uint32_t event_id) {
+void TestWindowTree::OnWindowInputEventAck(uint32_t event_id, bool handled) {
EXPECT_FALSE(acked_events_.count(event_id));
acked_events_.insert(event_id);
}
diff --git a/components/mus/public/cpp/tests/test_window_tree.h b/components/mus/public/cpp/tests/test_window_tree.h
index d392341..daaebb30 100644
--- a/components/mus/public/cpp/tests/test_window_tree.h
+++ b/components/mus/public/cpp/tests/test_window_tree.h
@@ -87,7 +87,7 @@ class TestWindowTree : public mojom::WindowTree {
void SetImeVisibility(uint32_t window_id,
bool visible,
mojo::TextInputStatePtr state) override;
- void OnWindowInputEventAck(uint32_t event_id) override;
+ void OnWindowInputEventAck(uint32_t event_id, bool handled) override;
void GetWindowManagerClient(
mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal)
override;
diff --git a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
index 69c498b..b822257 100644
--- a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
+++ b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
@@ -27,6 +27,12 @@
#include "ui/events/event_utils.h"
#include "ui/gfx/geometry/rect.h"
+namespace {
+
+void DoNothingBool(bool result) {}
+
+} // namespace
+
namespace mus {
mojo::Array<uint8_t> Int32ToPropertyTransportValue(int32_t value) {
@@ -122,21 +128,22 @@ class TestInputEventHandler : public InputEventHandler {
void AckEvent() {
DCHECK(should_manually_ack_);
DCHECK(!ack_callback_.is_null());
- ack_callback_.Run();
- ack_callback_ = base::Closure();
+ ack_callback_.Run(true);
+ ack_callback_ = base::Bind(&::DoNothingBool);
}
void Reset() {
received_event_ = false;
- ack_callback_ = base::Closure();
+ ack_callback_ = base::Bind(&::DoNothingBool);
}
bool received_event() const { return received_event_; }
private:
// InputEventHandler:
- void OnWindowInputEvent(Window* target,
- mojom::EventPtr event,
- scoped_ptr<base::Closure>* ack_callback) override {
+ void OnWindowInputEvent(
+ Window* target,
+ mojom::EventPtr event,
+ scoped_ptr<base::Callback<void(bool)>>* ack_callback) override {
EXPECT_FALSE(received_event_)
<< "Observer was not reset after receiving event.";
received_event_ = true;
@@ -148,7 +155,7 @@ class TestInputEventHandler : public InputEventHandler {
bool received_event_;
bool should_manually_ack_;
- base::Closure ack_callback_;
+ base::Callback<void(bool)> ack_callback_;
DISALLOW_COPY_AND_ASSIGN(TestInputEventHandler);
};