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

Unified Diff: mojo/runner/child/native_apptest.cc

Issue 1419293003: Allow mojo_runner to connect to arbitrary executables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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/runner/child/child_controller.mojom ('k') | mojo/runner/child/native_apptest_target.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/runner/child/native_apptest.cc
diff --git a/mojo/runner/child/native_apptest.cc b/mojo/runner/child/native_apptest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7bb7780add5f4adc3faa5840e63561cf30d51a73
--- /dev/null
+++ b/mojo/runner/child/native_apptest.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 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 "base/bind.h"
+#include "base/macros.h"
+#include "mojo/application/public/cpp/application_impl.h"
+#include "mojo/application/public/cpp/application_test_base.h"
+#include "mojo/converters/network/network_type_converters.h"
+#include "mojo/runner/child/test_native_service.mojom.h"
+
+namespace mojo {
+namespace runner {
+namespace {
+void InvertCallback(bool* result, bool from_native) {
+ *result = from_native;
+}
+} // namespace
+
+using NativeAppTest = mojo::test::ApplicationTestBase;
+
+TEST_F(NativeAppTest, Connect) {
+ test::TestNativeServicePtr native_service;
+ application_impl()->ConnectToService(
+ mojo::URLRequest::From(
+ std::string("exe:mojo_runner_child_apptest_native_target")),
+ &native_service);
+
+ bool result = false;
+ native_service->Invert(
+ true, base::Bind(&InvertCallback, base::Unretained(&result)));
+ native_service.WaitForIncomingResponse();
+ EXPECT_FALSE(result);
+
+ native_service->Invert(
+ false, base::Bind(&InvertCallback, base::Unretained(&result)));
+ native_service.WaitForIncomingResponse();
+ EXPECT_TRUE(result);
+}
+
+} // namespace runner
+} // namespace mojo
« no previous file with comments | « mojo/runner/child/child_controller.mojom ('k') | mojo/runner/child/native_apptest_target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698