| 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" |
| 11 #include "content/public/test/content_browser_test.h" | 11 #include "content/public/test/content_browser_test.h" |
| 12 #include "content/public/test/test_mojo_app.h" | 12 #include "content/public/test/test_mojo_app.h" |
| 13 #include "content/public/test/test_mojo_service.mojom.h" | 13 #include "content/public/test/test_mojo_service.mojom.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 const char kInProcessTestMojoAppUrl[] = "system:content_in_process_test_app"; | 18 const char kInProcessTestMojoAppUrl[] = "system:content_in_process_test_app"; |
| 19 | 19 |
| 20 class MojoShellTest : public ContentBrowserTest { | 20 class MojoShellTest : public ContentBrowserTest { |
| 21 public: | 21 public: |
| 22 MojoShellTest() { | 22 MojoShellTest() { |
| 23 test_apps_[GURL(kInProcessTestMojoAppUrl)] = base::Bind(&CreateTestApp); | 23 test_apps_[GURL(kInProcessTestMojoAppUrl)] = base::Bind(&CreateTestApp); |
| 24 MojoShellContext::SetApplicationsForTest(&test_apps_); | 24 MojoShellContext::SetApplicationsForTest(&test_apps_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 static scoped_ptr<mojo::ApplicationDelegate> CreateTestApp() { | 28 static scoped_ptr<mojo::ShellClient> CreateTestApp() { |
| 29 return scoped_ptr<mojo::ApplicationDelegate>(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(GURL(kInProcessTestMojoAppUrl), | 38 auto test_app = MojoAppConnection::Create(GURL(kInProcessTestMojoAppUrl), |
| 39 GURL(kBrowserMojoAppUrl)); | 39 GURL(kBrowserMojoAppUrl)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 GURL(kBrowserMojoAppUrl)); | 53 GURL(kBrowserMojoAppUrl)); |
| 54 TestMojoServicePtr test_service; | 54 TestMojoServicePtr test_service; |
| 55 test_app->ConnectToService(&test_service); | 55 test_app->ConnectToService(&test_service); |
| 56 | 56 |
| 57 base::RunLoop run_loop; | 57 base::RunLoop run_loop; |
| 58 test_service->DoSomething(run_loop.QuitClosure()); | 58 test_service->DoSomething(run_loop.QuitClosure()); |
| 59 run_loop.Run(); | 59 run_loop.Run(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace content | 62 } // namespace content |
| OLD | NEW |