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

Unified Diff: services/native_support/process_test_base.h

Issue 1919503003: native_support service: SynchronousInterfacePtr conversion in tests. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 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 | « services/native_support/process_impl_unittest.cc ('k') | services/native_support/process_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/native_support/process_test_base.h
diff --git a/services/native_support/process_test_base.h b/services/native_support/process_test_base.h
index 6b7900d41199ccf599c00946fb91642e2ad1666d..c7454ce114e1f25caf39a39a6f6f96a3aef377f7 100644
--- a/services/native_support/process_test_base.h
+++ b/services/native_support/process_test_base.h
@@ -9,53 +9,11 @@
#include "base/macros.h"
#include "mojo/public/cpp/application/application_test_base.h"
-#include "mojo/services/native_support/interfaces/process.mojom.h"
+#include "mojo/public/cpp/bindings/synchronous_interface_ptr.h"
+#include "mojo/services/native_support/interfaces/process.mojom-sync.h"
namespace native_support {
-// TODO(vtl): Stuff copied from mojo/public/cpp/bindings/lib/template_util.h.
-typedef char YesType;
-
-struct NoType {
- YesType dummy[2];
-};
-
-template <typename T>
-struct IsMoveOnlyType {
- template <typename U>
- static YesType Test(const typename U::MoveOnlyTypeForCPP03*);
-
- template <typename U>
- static NoType Test(...);
-
- static const bool value =
- sizeof(Test<T>(0)) == sizeof(YesType) && !std::is_const<T>::value;
-};
-
-template <typename T>
-typename std::enable_if<!IsMoveOnlyType<T>::value, T>::type& Forward(T& t) {
- return t;
-}
-
-template <typename T>
-typename std::enable_if<IsMoveOnlyType<T>::value, T>::type Forward(T& t) {
- return t.Pass();
-}
-// TODO(vtl): (End of stuff copied from template_util.h.)
-
-template <typename T1>
-mojo::Callback<void(T1)> Capture(T1* t1) {
- return [t1](T1 got_t1) { *t1 = Forward(got_t1); };
-}
-
-template <typename T1, typename T2>
-mojo::Callback<void(T1, T2)> Capture(T1* t1, T2* t2) {
- return [t1, t2](T1 got_t1, T2 got_t2) {
- *t1 = Forward(got_t1);
- *t2 = Forward(got_t2);
- };
-}
-
class ProcessTestBase : public mojo::test::ApplicationTestBase {
public:
ProcessTestBase();
@@ -64,10 +22,10 @@ class ProcessTestBase : public mojo::test::ApplicationTestBase {
void SetUp() override;
protected:
- ProcessPtr& process() { return process_; }
+ mojo::SynchronousInterfacePtr<Process>& process() { return process_; }
private:
- ProcessPtr process_;
+ mojo::SynchronousInterfacePtr<Process> process_;
DISALLOW_COPY_AND_ASSIGN(ProcessTestBase);
};
« no previous file with comments | « services/native_support/process_impl_unittest.cc ('k') | services/native_support/process_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698