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

Side by Side Diff: shell/shell_test_base.cc

Issue 1067173003: Remove mojo:: part of mojo::shell:: nested namespace in //shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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
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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "shell/filename_util.h" 14 #include "shell/filename_util.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace mojo {
18 namespace shell { 17 namespace shell {
19 namespace test { 18 namespace test {
20 19
21 namespace { 20 namespace {
22 21
23 void QuitIfRunning() { 22 void QuitIfRunning() {
24 if (base::MessageLoop::current() && 23 if (base::MessageLoop::current() &&
25 base::MessageLoop::current()->is_running()) { 24 base::MessageLoop::current()->is_running()) {
26 base::MessageLoop::current()->QuitWhenIdle(); 25 base::MessageLoop::current()->QuitWhenIdle();
27 } 26 }
28 } 27 }
29 28
30 } // namespace 29 } // namespace
31 30
32 ShellTestBase::ShellTestBase() { 31 ShellTestBase::ShellTestBase() {
33 } 32 }
34 33
35 ShellTestBase::~ShellTestBase() { 34 ShellTestBase::~ShellTestBase() {
36 } 35 }
37 36
38 void ShellTestBase::SetUp() { 37 void ShellTestBase::SetUp() {
39 CHECK(shell_context_.Init()); 38 CHECK(shell_context_.Init());
40 SetUpTestApplications(); 39 SetUpTestApplications();
41 } 40 }
42 41
43 void ShellTestBase::TearDown() { 42 void ShellTestBase::TearDown() {
44 shell_context_.Shutdown(); 43 shell_context_.Shutdown();
45 } 44 }
46 45
47 ScopedMessagePipeHandle ShellTestBase::ConnectToService( 46 mojo::ScopedMessagePipeHandle ShellTestBase::ConnectToService(
48 const GURL& application_url, 47 const GURL& application_url,
49 const std::string& service_name) { 48 const std::string& service_name) {
50 ServiceProviderPtr services; 49 mojo::ServiceProviderPtr services;
51 shell_context_.application_manager()->ConnectToApplication( 50 shell_context_.application_manager()->ConnectToApplication(
52 application_url, GURL(), GetProxy(&services), nullptr, 51 application_url, GURL(), mojo::GetProxy(&services), nullptr,
53 base::Bind(&QuitIfRunning)); 52 base::Bind(&QuitIfRunning));
54 MessagePipe pipe; 53 mojo::MessagePipe pipe;
55 services->ConnectToService(service_name, pipe.handle1.Pass()); 54 services->ConnectToService(service_name, pipe.handle1.Pass());
56 return pipe.handle0.Pass(); 55 return pipe.handle0.Pass();
57 } 56 }
58 57
59 #if !defined(OS_ANDROID) 58 #if !defined(OS_ANDROID)
60 void ShellTestBase::SetUpTestApplications() { 59 void ShellTestBase::SetUpTestApplications() {
61 // Set the URLResolver origin to be the same as the base file path for 60 // Set the URLResolver origin to be the same as the base file path for
62 // local files. This is primarily for test convenience, so that references 61 // local files. This is primarily for test convenience, so that references
63 // to unknown mojo: urls that do not have specific local file or custom 62 // to unknown mojo: urls that do not have specific local file or custom
64 // mappings registered on the URL resolver are treated as shared libraries. 63 // mappings registered on the URL resolver are treated as shared libraries.
65 base::FilePath service_dir; 64 base::FilePath service_dir;
66 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); 65 CHECK(PathService::Get(base::DIR_MODULE, &service_dir));
67 shell_context_.url_resolver()->SetMojoBaseURL(FilePathToFileURL(service_dir)); 66 shell_context_.url_resolver()->SetMojoBaseURL(FilePathToFileURL(service_dir));
68 } 67 }
69 #endif 68 #endif
70 69
71 } // namespace test 70 } // namespace test
72 } // namespace shell 71 } // namespace shell
73 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698