test_data_chromium.cc 880 B

1234567891011121314151617181920212223
  1. // Copyright 2019 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. #include "base/base_paths.h"
  5. #include "base/check.h"
  6. #include "base/files/file_path.h"
  7. #include "base/files/file_util.h"
  8. #include "base/path_service.h"
  9. // BoringSSL requires a GetTestData function to pick up test data files. By
  10. // default, BoringSSL generates a source file with the data embedded, but this
  11. // exceeds the limit for the _CheckForTooLargeFiles presubmit check.
  12. std::string GetTestData(const char *path) {
  13. base::FilePath file_path;
  14. base::PathService::Get(base::DIR_SOURCE_ROOT, &file_path);
  15. file_path = file_path.AppendASCII("third_party/boringssl/src");
  16. file_path = file_path.AppendASCII(path);
  17. std::string result;
  18. CHECK(base::ReadFileToString(file_path, &result));
  19. return result;
  20. }