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