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

Unified Diff: mojo/shell/app_child_process_host_unittest.cc

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 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/shell/app_child_process_host.cc ('k') | mojo/shell/application_manager/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/app_child_process_host_unittest.cc
diff --git a/mojo/shell/app_child_process_host_unittest.cc b/mojo/shell/app_child_process_host_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..37624bf31b19d9781806c8a6830b7f14c04d2b40
--- /dev/null
+++ b/mojo/shell/app_child_process_host_unittest.cc
@@ -0,0 +1,63 @@
+// Copyright 2014 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.
+
+// Note: This file also tests app_child_process.*.
+
+#include "mojo/shell/app_child_process_host.h"
+
+#include "base/logging.h"
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/common/message_pump_mojo.h"
+#include "mojo/shell/context.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace shell {
+namespace {
+
+// Subclass just so we can observe |DidStart()|.
+class TestAppChildProcessHost : public AppChildProcessHost {
+ public:
+ explicit TestAppChildProcessHost(Context* context)
+ : AppChildProcessHost(context) {}
+ ~TestAppChildProcessHost() override {}
+
+ void DidStart(bool success) override {
+ EXPECT_TRUE(success);
+ AppChildProcessHost::DidStart(success);
+ base::MessageLoop::current()->QuitWhenIdle();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestAppChildProcessHost);
+};
+
+#if defined(OS_ANDROID)
+// TODO(qsr): Multiprocess shell tests are not supported on android.
+#define MAYBE_StartJoin DISABLED_StartJoin
+#else
+#define MAYBE_StartJoin StartJoin
+#endif // defined(OS_ANDROID)
+// Just tests starting the child process and joining it (without starting an
+// app).
+TEST(AppChildProcessHostTest, MAYBE_StartJoin) {
+ Context context;
+ base::MessageLoop message_loop(
+ scoped_ptr<base::MessagePump>(new common::MessagePumpMojo()));
+ context.Init();
+ TestAppChildProcessHost app_child_process_host(&context);
+ app_child_process_host.Start();
+ message_loop.Run();
+ app_child_process_host.ExitNow(123);
+ int exit_code = app_child_process_host.Join();
+ VLOG(2) << "Joined child: exit_code = " << exit_code;
+ EXPECT_EQ(123, exit_code);
+
+ context.Shutdown();
+}
+
+} // namespace
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/app_child_process_host.cc ('k') | mojo/shell/application_manager/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698