| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" // TODO(vtl): Remove. | 8 #include "base/macros.h" // TODO(vtl): Remove. |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/common/message_pump_mojo.h" // TODO(vtl): Remove. | 10 #include "mojo/common/message_pump_mojo.h" // TODO(vtl): Remove. |
| 11 #include "mojo/public/cpp/environment/environment.h" |
| 11 #include "mojo/shell/child_process.h" | 12 #include "mojo/shell/child_process.h" |
| 12 #include "mojo/shell/child_process_host.h" // TODO(vtl): Remove. | 13 #include "mojo/shell/child_process_host.h" // TODO(vtl): Remove. |
| 13 #include "mojo/shell/context.h" | 14 #include "mojo/shell/context.h" |
| 14 #include "mojo/shell/init.h" | 15 #include "mojo/shell/init.h" |
| 15 #include "mojo/shell/run.h" | 16 #include "mojo/shell/run.h" |
| 16 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // TODO(vtl): Remove. | 21 // TODO(vtl): Remove. |
| 21 class TestChildProcessHostDelegate | 22 class TestChildProcessHostDelegate |
| 22 : public mojo::shell::ChildProcessHost::Delegate { | 23 : public mojo::shell::ChildProcessHost::Delegate { |
| 23 public: | 24 public: |
| 24 TestChildProcessHostDelegate() {} | 25 TestChildProcessHostDelegate() {} |
| 25 virtual ~TestChildProcessHostDelegate() {} | 26 virtual ~TestChildProcessHostDelegate() {} |
| 26 virtual void WillStart() OVERRIDE { | 27 virtual void WillStart() OVERRIDE { |
| 27 VLOG(2) << "TestChildProcessHostDelegate::WillStart()"; | 28 VLOG(2) << "TestChildProcessHostDelegate::WillStart()"; |
| 28 } | 29 } |
| 29 virtual void DidStart(bool success) OVERRIDE { | 30 virtual void DidStart(bool success) OVERRIDE { |
| 30 VLOG(2) << "TestChildProcessHostDelegate::DidStart(" << success << ")"; | 31 VLOG(2) << "TestChildProcessHostDelegate::DidStart(" << success << ")"; |
| 31 base::MessageLoop::current()->QuitWhenIdle(); | 32 base::MessageLoop::current()->QuitWhenIdle(); |
| 32 } | 33 } |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 } // namespace | 36 } // namespace |
| 36 | 37 |
| 37 int main(int argc, char** argv) { | 38 int main(int argc, char** argv) { |
| 38 base::AtExitManager at_exit; | 39 base::AtExitManager at_exit; |
| 40 mojo::Environment env; |
| 39 CommandLine::Init(argc, argv); | 41 CommandLine::Init(argc, argv); |
| 40 mojo::shell::InitializeLogging(); | 42 mojo::shell::InitializeLogging(); |
| 41 | 43 |
| 42 // TODO(vtl): Move this a proper test (and remove includes marked "remove"). | 44 // TODO(vtl): Move this a proper test (and remove includes marked "remove"). |
| 43 if (CommandLine::ForCurrentProcess()->HasSwitch("run-test-child")) { | 45 if (CommandLine::ForCurrentProcess()->HasSwitch("run-test-child")) { |
| 44 base::MessageLoop message_loop( | 46 base::MessageLoop message_loop( |
| 45 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo())); | 47 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo())); |
| 46 | 48 |
| 47 mojo::shell::Context context; | 49 mojo::shell::Context context; |
| 48 TestChildProcessHostDelegate child_process_host_delegate; | 50 TestChildProcessHostDelegate child_process_host_delegate; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 | 68 |
| 67 base::MessageLoop message_loop; | 69 base::MessageLoop message_loop; |
| 68 mojo::shell::Context context; | 70 mojo::shell::Context context; |
| 69 message_loop.PostTask(FROM_HERE, base::Bind(mojo::shell::Run, &context)); | 71 message_loop.PostTask(FROM_HERE, base::Bind(mojo::shell::Run, &context)); |
| 70 | 72 |
| 71 message_loop.Run(); | 73 message_loop.Run(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 return 0; | 76 return 0; |
| 75 } | 77 } |
| OLD | NEW |