mojo: Add router for python bindings.
[chromium-blink-merge.git] / chromeos / chromeos_test_utils.cc
blob8a3456bc781b8b9e84faf753cd1fbd00364b6d9f
1 // Copyright (c) 2012 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 "chromeos/chromeos_test_utils.h"
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
11 namespace chromeos {
12 namespace test_utils {
14 bool GetTestDataPath(const std::string& component,
15 const std::string& filename,
16 base::FilePath* data_dir) {
17 base::FilePath path;
18 if (!PathService::Get(base::DIR_SOURCE_ROOT, &path))
19 return false;
20 path = path.Append(FILE_PATH_LITERAL("chromeos"));
21 path = path.Append(FILE_PATH_LITERAL("test"));
22 path = path.Append(FILE_PATH_LITERAL("data"));
23 if (!base::PathExists(path)) // We don't want to create this.
24 return false;
25 DCHECK(data_dir);
26 path = path.Append(component);
27 *data_dir = path.Append(filename);
28 return true;
31 } // namespace test_utils
32 } // namespace chromeos