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 |