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

Unified Diff: mojo/ui/associates/mock_hit_tester.cc

Issue 1778593003: Mozart: Add helpers for building view associates. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-6
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/ui/associates/mock_hit_tester.h ('k') | mojo/ui/associates/mock_view_inspector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/ui/associates/mock_hit_tester.cc
diff --git a/mojo/ui/associates/mock_hit_tester.cc b/mojo/ui/associates/mock_hit_tester.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a16dc4bac889a764ee6e90a026ade751972ebf8b
--- /dev/null
+++ b/mojo/ui/associates/mock_hit_tester.cc
@@ -0,0 +1,39 @@
+// Copyright 2016 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.
+
+#include "mojo/ui/associates/mock_hit_tester.h"
+
+#include "base/bind.h"
+
+namespace mojo {
+namespace ui {
+
+MockHitTester::MockHitTester() {}
+
+MockHitTester::~MockHitTester() {}
+
+void MockHitTester::SetNextResult(
+ mojo::PointPtr point,
+ mojo::gfx::composition::HitTestResultPtr result) {
+ DCHECK(point);
+ DCHECK(result);
+
+ point_ = point.Pass();
+ result_ = result.Pass();
+}
+
+void MockHitTester::HitTest(mojo::PointPtr point,
+ const HitTestCallback& callback) {
+ DCHECK(point);
+
+ if (point.Equals(point_)) {
+ point_.reset();
+ callback.Run(result_.Pass());
+ } else {
+ callback.Run(mojo::gfx::composition::HitTestResult::New());
+ }
+}
+
+} // namespace ui
+} // namespace mojo
« no previous file with comments | « mojo/ui/associates/mock_hit_tester.h ('k') | mojo/ui/associates/mock_view_inspector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698