Remove 'RemoveTrailingSeparators' function from SimpleMenuModel
[chromium-blink-merge.git] / mojo / shell / shell_test_helper.cc
blob0a4673035bf8c0b43e7cb3735c35d2f731bcf2c8
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.
5 #include "mojo/shell/shell_test_helper.h"
7 #include "base/command_line.h"
8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h"
10 #include "base/logging.h"
11 #include "base/path_service.h"
12 #include "mojo/shell/filename_util.h"
13 #include "mojo/shell/init.h"
14 #include "mojo/shell/url_resolver.h"
16 namespace mojo {
17 namespace shell {
19 ShellTestHelper::ShellTestHelper() {
20 base::CommandLine::Init(0, nullptr);
21 InitializeLogging();
24 ShellTestHelper::~ShellTestHelper() {
27 void ShellTestHelper::Init() {
28 context_.Init();
29 test_api_.reset(
30 new ApplicationManager::TestAPI(context_.application_manager()));
31 base::FilePath service_dir;
32 CHECK(PathService::Get(base::DIR_MODULE, &service_dir));
33 context_.url_resolver()->SetMojoBaseURL(FilePathToFileURL(service_dir));
36 void ShellTestHelper::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader,
37 const GURL& url) {
38 context_.application_manager()->SetLoaderForURL(loader.Pass(), url);
41 void ShellTestHelper::AddURLMapping(const GURL& url, const GURL& resolved_url) {
42 context_.url_resolver()->AddURLMapping(url, resolved_url);
45 } // namespace shell
46 } // namespace mojo