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

Side by Side Diff: mojo/shell/shell_test_base_unittest.cc

Issue 314293002: Mojo: Add a trivial end-to-end (in-process) test of Mojo shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/shell/shell_test_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « mojo/shell/shell_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698