OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/mojo/mojo_shell_context.h" | 9 #include "content/browser/mojo/mojo_shell_context.h" |
10 #include "content/public/browser/mojo_app_connection.h" | 10 #include "content/public/browser/mojo_app_connection.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 static scoped_ptr<mojo::ShellClient> CreateTestApp() { | 28 static scoped_ptr<mojo::ShellClient> CreateTestApp() { |
29 return scoped_ptr<mojo::ShellClient>(new TestMojoApp); | 29 return scoped_ptr<mojo::ShellClient>(new TestMojoApp); |
30 } | 30 } |
31 | 31 |
32 MojoShellContext::StaticApplicationMap test_apps_; | 32 MojoShellContext::StaticApplicationMap test_apps_; |
33 | 33 |
34 DISALLOW_COPY_AND_ASSIGN(MojoShellTest); | 34 DISALLOW_COPY_AND_ASSIGN(MojoShellTest); |
35 }; | 35 }; |
36 | 36 |
37 IN_PROC_BROWSER_TEST_F(MojoShellTest, TestBrowserConnection) { | 37 IN_PROC_BROWSER_TEST_F(MojoShellTest, TestBrowserConnection) { |
38 auto test_app = MojoAppConnection::Create(kInProcessTestMojoAppName, | 38 auto test_app = MojoAppConnection::Create(GetBrowserContext(), |
| 39 kInProcessTestMojoAppName, |
39 kBrowserMojoAppUrl); | 40 kBrowserMojoAppUrl); |
40 TestMojoServicePtr test_service; | 41 TestMojoServicePtr test_service; |
41 test_app->GetInterface(&test_service); | 42 test_app->GetInterface(&test_service); |
42 | 43 |
43 base::RunLoop run_loop; | 44 base::RunLoop run_loop; |
44 test_service->DoSomething(run_loop.QuitClosure()); | 45 test_service->DoSomething(run_loop.QuitClosure()); |
45 run_loop.Run(); | 46 run_loop.Run(); |
46 } | 47 } |
47 | 48 |
48 IN_PROC_BROWSER_TEST_F(MojoShellTest, TestUtilityConnection) { | 49 IN_PROC_BROWSER_TEST_F(MojoShellTest, TestUtilityConnection) { |
49 // With no loader registered at this URL, the shell should spawn a utility | 50 // With no loader registered at this URL, the shell should spawn a utility |
50 // process and connect us to it. content_shell's utility process always hosts | 51 // process and connect us to it. content_shell's utility process always hosts |
51 // a TestMojoApp at |kTestMojoAppUrl|. | 52 // a TestMojoApp at |kTestMojoAppUrl|. |
52 auto test_app = MojoAppConnection::Create(kTestMojoAppUrl, | 53 auto test_app = MojoAppConnection::Create(GetBrowserContext(), |
| 54 kTestMojoAppUrl, |
53 kBrowserMojoAppUrl); | 55 kBrowserMojoAppUrl); |
54 TestMojoServicePtr test_service; | 56 TestMojoServicePtr test_service; |
55 test_app->GetInterface(&test_service); | 57 test_app->GetInterface(&test_service); |
56 | 58 |
57 base::RunLoop run_loop; | 59 base::RunLoop run_loop; |
58 test_service->DoSomething(run_loop.QuitClosure()); | 60 test_service->DoSomething(run_loop.QuitClosure()); |
59 run_loop.Run(); | 61 run_loop.Run(); |
60 } | 62 } |
61 | 63 |
62 } // namespace content | 64 } // namespace content |
OLD | NEW |