Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: shell/shell_test_base.cc

Issue 939353002: Fix mojo::shell::Context shutdown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« shell/desktop/mojo_main.cc ('K') | « shell/shell_test_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "shell/shell_test_base.h" 5 #include "shell/shell_test_base.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "shell/filename_util.h" 13 #include "shell/filename_util.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace shell { 17 namespace shell {
18 namespace test { 18 namespace test {
19 19
20 ShellTestBase::ShellTestBase() { 20 ShellTestBase::ShellTestBase() {
21 } 21 }
22 22
23 ShellTestBase::~ShellTestBase() { 23 ShellTestBase::~ShellTestBase() {
24 } 24 }
25 25
26 void ShellTestBase::SetUp() { 26 void ShellTestBase::SetUp() {
27 shell_context_.Init(); 27 CHECK(shell_context_.Init());
28 SetUpTestApplications(); 28 SetUpTestApplications();
29 } 29 }
30 30
31 void ShellTestBase::TearDown() {
32 shell_context_.Shutdown();
33 }
34
31 ScopedMessagePipeHandle ShellTestBase::ConnectToService( 35 ScopedMessagePipeHandle ShellTestBase::ConnectToService(
32 const GURL& application_url, 36 const GURL& application_url,
33 const std::string& service_name) { 37 const std::string& service_name) {
34 return shell_context_.ConnectToServiceByName(application_url, service_name) 38 return shell_context_.ConnectToServiceByName(application_url, service_name)
35 .Pass(); 39 .Pass();
36 } 40 }
37 41
38 #if !defined(OS_ANDROID) 42 #if !defined(OS_ANDROID)
39 void ShellTestBase::SetUpTestApplications() { 43 void ShellTestBase::SetUpTestApplications() {
40 // Set the URLResolver origin to be the same as the base file path for 44 // Set the URLResolver origin to be the same as the base file path for
41 // local files. This is primarily for test convenience, so that references 45 // local files. This is primarily for test convenience, so that references
42 // to unknown mojo: urls that do not have specific local file or custom 46 // to unknown mojo: urls that do not have specific local file or custom
43 // mappings registered on the URL resolver are treated as shared libraries. 47 // mappings registered on the URL resolver are treated as shared libraries.
44 base::FilePath service_dir; 48 base::FilePath service_dir;
45 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); 49 CHECK(PathService::Get(base::DIR_MODULE, &service_dir));
46 shell_context_.url_resolver()->SetMojoBaseURL(FilePathToFileURL(service_dir)); 50 shell_context_.url_resolver()->SetMojoBaseURL(FilePathToFileURL(service_dir));
47 } 51 }
48 #endif 52 #endif
49 53
50 } // namespace test 54 } // namespace test
51 } // namespace shell 55 } // namespace shell
52 } // namespace mojo 56 } // namespace mojo
OLDNEW
« shell/desktop/mojo_main.cc ('K') | « shell/shell_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698