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

Unified Diff: mojo/public/tests/simple_bindings_support.h

Issue 54743003: Mojo: bindings connector (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extract SimpleBindingsSupport Created 7 years, 1 month 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
Index: mojo/public/tests/simple_bindings_support.h
diff --git a/mojo/public/tests/simple_bindings_support.h b/mojo/public/tests/simple_bindings_support.h
new file mode 100644
index 0000000000000000000000000000000000000000..c22de82f35f2a9ed8037b3c1774e42a7b46a7cb3
--- /dev/null
+++ b/mojo/public/tests/simple_bindings_support.h
@@ -0,0 +1,47 @@
+// Copyright 2013 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 MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_
+#define MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_
+
+#include <list>
+
+#include "mojo/public/bindings/lib/bindings_support.h"
+
+namespace mojo {
+namespace test {
+
+class SimpleBindingsSupport : public BindingsSupport {
+ public:
+ SimpleBindingsSupport();
+ virtual ~SimpleBindingsSupport();
+
+ virtual bool AsyncWait(Handle handle,
+ MojoWaitFlags flags,
+ MojoDeadline deadline,
+ AsyncWaitCallback* callback) MOJO_OVERRIDE;
+ virtual void CancelWait(AsyncWaitCallback* callback) MOJO_OVERRIDE;
+
+ // This method is called by unit tests to check the status of any handles
+ // that we are asynchronously waiting on and to dispatch callbacks for any
+ // handles that are ready.
+ void Process();
+
+ private:
+ bool IsReady(Handle handle, MojoWaitFlags flags, MojoResult* result);
+
+ struct Waiter {
+ Handle handle;
+ MojoWaitFlags flags;
+ MojoDeadline deadline;
+ AsyncWaitCallback* callback;
+ };
+
+ std::list<Waiter> waiters_;
+};
+
+} // namespace test
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_TESTS_SIMPLE_BINDINGS_SUPPORT_H_

Powered by Google App Engine
This is Rietveld 408576698