shell_test_base.cc revision 116680a4aac90f2aa7413d9095a592090648e557
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 3// found in the LICENSE file. 4 5#include "mojo/shell/shell_test_base.h" 6 7#include "base/command_line.h" 8#include "base/file_util.h" 9#include "base/files/file_path.h" 10#include "base/logging.h" 11#include "base/path_service.h" 12#include "build/build_config.h" 13#include "net/base/filename_util.h" 14#include "url/gurl.h" 15 16namespace mojo { 17namespace shell { 18namespace test { 19 20ShellTestBase::ShellTestBase() { 21} 22 23ShellTestBase::~ShellTestBase() { 24} 25 26ScopedMessagePipeHandle ShellTestBase::ConnectToService( 27 const GURL& application_url, 28 const std::string& service_name) { 29 base::FilePath service_dir; 30 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); 31 shell_context_.mojo_url_resolver()->set_origin( 32 net::FilePathToFileURL(service_dir).spec()); 33 34 return shell_context_.service_manager()->ConnectToServiceByName( 35 application_url, service_name).Pass(); 36} 37 38} // namespace test 39} // namespace shell 40} // namespace mojo 41