| Index: shell/app_child_process_host_unittest.cc
|
| diff --git a/shell/child_process_host_unittest.cc b/shell/app_child_process_host_unittest.cc
|
| similarity index 52%
|
| rename from shell/child_process_host_unittest.cc
|
| rename to shell/app_child_process_host_unittest.cc
|
| index c52c8c78c26d37df5f1bc1ba1bd8616abf8a8aa8..9c9f7ecf57e84bb85d820af56a500cc71f4f96c2 100644
|
| --- a/shell/child_process_host_unittest.cc
|
| +++ b/shell/app_child_process_host_unittest.cc
|
| @@ -2,9 +2,9 @@
|
| // 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 child_process.*.
|
| +// Note: This file also tests app_child_process.*.
|
|
|
| -#include "shell/child_process_host.h"
|
| +#include "shell/app_child_process_host.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| @@ -15,48 +15,49 @@
|
|
|
| namespace mojo {
|
| namespace shell {
|
| -namespace test {
|
| namespace {
|
|
|
| -class TestChildProcessHostDelegate : public ChildProcessHost::Delegate {
|
| +// Subclass just so we can observe |DidStart()|.
|
| +class TestAppChildProcessHost : public AppChildProcessHost {
|
| public:
|
| - TestChildProcessHostDelegate() {}
|
| - ~TestChildProcessHostDelegate() {}
|
| - void WillStart() override {
|
| - VLOG(2) << "TestChildProcessHostDelegate::WillStart()";
|
| - }
|
| + explicit TestAppChildProcessHost(Context* context)
|
| + : AppChildProcessHost(context) {}
|
| + ~TestAppChildProcessHost() override {}
|
| +
|
| void DidStart(bool success) override {
|
| - VLOG(2) << "TestChildProcessHostDelegate::DidStart(" << success << ")";
|
| + EXPECT_TRUE(success);
|
| + AppChildProcessHost::DidStart(success);
|
| base::MessageLoop::current()->QuitWhenIdle();
|
| }
|
| -};
|
|
|
| -typedef testing::Test ChildProcessHostTest;
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(TestAppChildProcessHost);
|
| +};
|
|
|
| #if defined(OS_ANDROID)
|
| // TODO(qsr): Multiprocess shell tests are not supported on android.
|
| -#define MAYBE_Basic DISABLED_Basic
|
| +#define MAYBE_StartJoin DISABLED_StartJoin
|
| #else
|
| -#define MAYBE_Basic Basic
|
| +#define MAYBE_StartJoin StartJoin
|
| #endif // defined(OS_ANDROID)
|
| -TEST_F(ChildProcessHostTest, MAYBE_Basic) {
|
| +// 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();
|
| - TestChildProcessHostDelegate child_process_host_delegate;
|
| - ChildProcessHost child_process_host(&context, &child_process_host_delegate,
|
| - ChildProcess::TYPE_TEST);
|
| - child_process_host.Start();
|
| + TestAppChildProcessHost app_child_process_host(&context);
|
| + app_child_process_host.Start();
|
| message_loop.Run();
|
| - int exit_code = child_process_host.Join();
|
| + app_child_process_host.ExitNow(123);
|
| + int exit_code = app_child_process_host.Join();
|
| VLOG(2) << "Joined child: exit_code = " << exit_code;
|
| - EXPECT_EQ(0, exit_code);
|
| + EXPECT_EQ(123, exit_code);
|
|
|
| context.Shutdown();
|
| }
|
|
|
| } // namespace
|
| -} // namespace test
|
| } // namespace shell
|
| } // namespace mojo
|
|
|