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 "components/web_view/test_runner/launcher.h" | 5 #include "components/web_view/test_runner/launcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/path_service.h" |
9 #include "mojo/runner/context.h" | 10 #include "mojo/runner/context.h" |
10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
11 | 12 |
12 namespace web_view { | 13 namespace web_view { |
13 | 14 |
14 int LaunchTestRunner(int argc, char** argv) { | 15 int LaunchTestRunner(int argc, char** argv) { |
| 16 base::FilePath shell_dir; |
| 17 PathService::Get(base::DIR_MODULE, &shell_dir); |
15 // We want the runner::Context to outlive the MessageLoop so that pipes are | 18 // We want the runner::Context to outlive the MessageLoop so that pipes are |
16 // all gracefully closed / error-out before we try to shut the Context down. | 19 // all gracefully closed / error-out before we try to shut the Context down. |
17 mojo::runner::Context shell_context; | 20 mojo::runner::Context shell_context(shell_dir); |
18 { | 21 { |
19 base::MessageLoop message_loop; | 22 base::MessageLoop message_loop; |
20 if (!shell_context.Init()) { | 23 if (!shell_context.Init()) { |
21 return 0; | 24 return 0; |
22 } | 25 } |
23 | 26 |
24 message_loop.PostTask(FROM_HERE, | 27 message_loop.PostTask(FROM_HERE, |
25 base::Bind(&mojo::runner::Context::Run, | 28 base::Bind(&mojo::runner::Context::Run, |
26 base::Unretained(&shell_context), | 29 base::Unretained(&shell_context), |
27 GURL("mojo:web_view_test_runner"))); | 30 GURL("mojo:web_view_test_runner"))); |
28 message_loop.Run(); | 31 message_loop.Run(); |
29 | 32 |
30 // Must be called before |message_loop| is destroyed. | 33 // Must be called before |message_loop| is destroyed. |
31 shell_context.Shutdown(); | 34 shell_context.Shutdown(); |
32 } | 35 } |
33 | 36 |
34 return 0; | 37 return 0; |
35 } | 38 } |
36 | 39 |
37 } // namespace web_view | 40 } // namespace web_view |
OLD | NEW |