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