• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Authors
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 "base/base_paths.h"
6 #include "base/check.h"
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
10 
11 // Tests running on Chromium infrastructure cannot find their test data without
12 // using `base::PathService`, so we swap out the `GetTestData` function with a
13 // Chromium-specific one.
GetTestData(const char * path)14 std::string GetTestData(const char *path) {
15   base::FilePath file_path;
16   base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &file_path);
17   file_path = file_path.AppendASCII("third_party/boringssl/src");
18   file_path = file_path.AppendASCII(path);
19 
20   std::string result;
21   CHECK(base::ReadFileToString(file_path, &result));
22   return result;
23 }
24