OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/shell/shell_test_base.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 10 #include "mojo/public/cpp/system/core.h" |
| 11 #include "mojo/services/test_service/test_service.mojom.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace mojo { |
| 16 namespace shell { |
| 17 namespace test { |
| 18 namespace { |
| 19 |
| 20 typedef ShellTestBase ShellTestBaseTest; |
| 21 |
| 22 void PingCallback(base::MessageLoop* message_loop) { |
| 23 VLOG(2) << "Ping callback"; |
| 24 message_loop->QuitWhenIdle(); |
| 25 } |
| 26 |
| 27 TEST_F(ShellTestBaseTest, LaunchServiceInProcess) { |
| 28 InitMojo(); |
| 29 |
| 30 InterfacePtr<mojo::test::ITestService> test_service; |
| 31 |
| 32 { |
| 33 MessagePipe mp; |
| 34 test_service.Bind(mp.handle0.Pass()); |
| 35 LaunchServiceInProcess(GURL("mojo:mojo_test_service"), |
| 36 mojo::test::ITestService::Name_, |
| 37 mp.handle1.Pass()); |
| 38 } |
| 39 |
| 40 test_service->Ping(base::Bind(&PingCallback, |
| 41 base::Unretained(message_loop()))); |
| 42 message_loop()->Run(); |
| 43 |
| 44 test_service.reset(); |
| 45 |
| 46 // This will run until the test service has actually quit (which it will, |
| 47 // since we killed the only connection to it). |
| 48 message_loop()->Run(); |
| 49 } |
| 50 |
| 51 } // namespace |
| 52 } // namespace test |
| 53 } // namespace shell |
| 54 } // namespace mojo |
| 55 |
OLD | NEW |