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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/mojo/mojo_shell_context.h" | 10 #include "content/browser/mojo/mojo_shell_context.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 MojoShellContext::SetApplicationsForTest(&test_apps_); | 28 MojoShellContext::SetApplicationsForTest(&test_apps_); |
29 } | 29 } |
30 | 30 |
31 protected: | 31 protected: |
32 std::string GetUserId() { | 32 std::string GetUserId() { |
33 return BrowserContext::GetMojoUserIdFor( | 33 return BrowserContext::GetMojoUserIdFor( |
34 shell()->web_contents()->GetBrowserContext()); | 34 shell()->web_contents()->GetBrowserContext()); |
35 } | 35 } |
36 | 36 |
37 private: | 37 private: |
38 static std::unique_ptr<mojo::ShellClient> CreateTestApp() { | 38 static std::unique_ptr<shell::ShellClient> CreateTestApp() { |
39 return std::unique_ptr<mojo::ShellClient>(new TestMojoApp); | 39 return std::unique_ptr<shell::ShellClient>(new TestMojoApp); |
40 } | 40 } |
41 | 41 |
42 MojoShellContext::StaticApplicationMap test_apps_; | 42 MojoShellContext::StaticApplicationMap test_apps_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(MojoShellTest); | 44 DISALLOW_COPY_AND_ASSIGN(MojoShellTest); |
45 }; | 45 }; |
46 | 46 |
47 IN_PROC_BROWSER_TEST_F(MojoShellTest, TestBrowserConnection) { | 47 IN_PROC_BROWSER_TEST_F(MojoShellTest, TestBrowserConnection) { |
48 auto test_app = MojoAppConnection::Create( | 48 auto test_app = MojoAppConnection::Create( |
49 GetUserId(), kInProcessTestMojoAppName, kBrowserMojoAppUrl); | 49 GetUserId(), kInProcessTestMojoAppName, kBrowserMojoAppUrl); |
(...skipping 13 matching lines...) Expand all Loading... |
63 kBrowserMojoAppUrl); | 63 kBrowserMojoAppUrl); |
64 mojom::TestMojoServicePtr test_service; | 64 mojom::TestMojoServicePtr test_service; |
65 test_app->GetInterface(&test_service); | 65 test_app->GetInterface(&test_service); |
66 | 66 |
67 base::RunLoop run_loop; | 67 base::RunLoop run_loop; |
68 test_service->DoSomething(run_loop.QuitClosure()); | 68 test_service->DoSomething(run_loop.QuitClosure()); |
69 run_loop.Run(); | 69 run_loop.Run(); |
70 } | 70 } |
71 | 71 |
72 } // namespace content | 72 } // namespace content |
OLD | NEW |