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 // BoringSSL requires a GetTestData function to pick up test data files. By 12 // default, BoringSSL generates a source file with the data embedded, but this 13 // exceeds the limit for the _CheckForTooLargeFiles presubmit check. GetTestData(const char * path)14std::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