gtest_links.h 1.0 KB

12345678910111213141516171819202122232425262728
  1. // Copyright 2020 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. #ifndef BASE_TEST_GTEST_LINKS_H_
  5. #define BASE_TEST_GTEST_LINKS_H_
  6. #include <string>
  7. namespace base {
  8. // Add a link in the gtest xml output.
  9. // Only call this from a gtest test body with the same thread as the test.
  10. // Only works on desktop.
  11. // A test can call this function when the test generates a link and save it
  12. // as part of the test result.
  13. // Example: AddLinkToTestResult("image_link",
  14. // "https://example_googlestorage/test.png") can mean a test generates an image
  15. // with the url.
  16. // |name| is the link name. It should be unique in one test case. Name will
  17. // be displayed on test result page(Milo). |name| should only contains
  18. // ascii-letters, ascii-digits, '/' and '_'.
  19. // |url| the actual url.
  20. void AddLinkToTestResult(const std::string& name, const std::string& url);
  21. } // namespace base
  22. #endif // BASE_TEST_GTEST_LINKS_H_