1*dfc6aa5cSAndroid Build Coastguard Worker /* 2*dfc6aa5cSAndroid Build Coastguard Worker * Copyright 2020 The Chromium Authors. All Rights Reserved. 3*dfc6aa5cSAndroid Build Coastguard Worker * 4*dfc6aa5cSAndroid Build Coastguard Worker * This software is provided 'as-is', without any express or implied 5*dfc6aa5cSAndroid Build Coastguard Worker * warranty. In no event will the authors be held liable for any damages 6*dfc6aa5cSAndroid Build Coastguard Worker * arising from the use of this software. 7*dfc6aa5cSAndroid Build Coastguard Worker * 8*dfc6aa5cSAndroid Build Coastguard Worker * Permission is granted to anyone to use this software for any purpose, 9*dfc6aa5cSAndroid Build Coastguard Worker * including commercial applications, and to alter it and redistribute it 10*dfc6aa5cSAndroid Build Coastguard Worker * freely, subject to the following restrictions: 11*dfc6aa5cSAndroid Build Coastguard Worker * 12*dfc6aa5cSAndroid Build Coastguard Worker * 1. The origin of this software must not be misrepresented; you must not 13*dfc6aa5cSAndroid Build Coastguard Worker * claim that you wrote the original software. If you use this software 14*dfc6aa5cSAndroid Build Coastguard Worker * in a product, an acknowledgment in the product documentation would be 15*dfc6aa5cSAndroid Build Coastguard Worker * appreciated but is not required. 16*dfc6aa5cSAndroid Build Coastguard Worker * 2. Altered source versions must be plainly marked as such, and must not be 17*dfc6aa5cSAndroid Build Coastguard Worker * misrepresented as being the original software. 18*dfc6aa5cSAndroid Build Coastguard Worker * 3. This notice may not be removed or altered from any source distribution. 19*dfc6aa5cSAndroid Build Coastguard Worker */ 20*dfc6aa5cSAndroid Build Coastguard Worker 21*dfc6aa5cSAndroid Build Coastguard Worker #ifndef THIRD_PARTY_LIBJPEG_TURBO_GTEST_UTILS_H_ 22*dfc6aa5cSAndroid Build Coastguard Worker #define THIRD_PARTY_LIBJPEG_TURBO_GTEST_UTILS_H_ 23*dfc6aa5cSAndroid Build Coastguard Worker 24*dfc6aa5cSAndroid Build Coastguard Worker #include "base/files/file.h" 25*dfc6aa5cSAndroid Build Coastguard Worker #include "base/files/file_util.h" 26*dfc6aa5cSAndroid Build Coastguard Worker #include "base/hash/md5.h" 27*dfc6aa5cSAndroid Build Coastguard Worker #include "base/path_service.h" 28*dfc6aa5cSAndroid Build Coastguard Worker #include "gtest-utils.h" 29*dfc6aa5cSAndroid Build Coastguard Worker 30*dfc6aa5cSAndroid Build Coastguard Worker #include <gtest/gtest.h> 31*dfc6aa5cSAndroid Build Coastguard Worker #include <string> 32*dfc6aa5cSAndroid Build Coastguard Worker 33*dfc6aa5cSAndroid Build Coastguard Worker // Returns the absolute path of the test output directory as a string. 34*dfc6aa5cSAndroid Build Coastguard Worker // On Android this path is /sdcard; on all other platforms it is the current 35*dfc6aa5cSAndroid Build Coastguard Worker // directory. 36*dfc6aa5cSAndroid Build Coastguard Worker #if defined(OS_WIN) 37*dfc6aa5cSAndroid Build Coastguard Worker std::wstring GetTargetDirectory(); 38*dfc6aa5cSAndroid Build Coastguard Worker #else 39*dfc6aa5cSAndroid Build Coastguard Worker std::string GetTargetDirectory(); 40*dfc6aa5cSAndroid Build Coastguard Worker #endif 41*dfc6aa5cSAndroid Build Coastguard Worker 42*dfc6aa5cSAndroid Build Coastguard Worker // Files used as input for libjpeg-turbo unit tests are stored in 43*dfc6aa5cSAndroid Build Coastguard Worker // <chromium>/src/third_party/libjpeg_turbo/testimages. 44*dfc6aa5cSAndroid Build Coastguard Worker // Given a test file |filename|, this function will set |path| to 45*dfc6aa5cSAndroid Build Coastguard Worker // <chromium>/src/third_party/libjpeg_turbo/testimages/filename 46*dfc6aa5cSAndroid Build Coastguard Worker // If the file does not exit an assertion will fail. 47*dfc6aa5cSAndroid Build Coastguard Worker void GetTestFilePath(base::FilePath* path, 48*dfc6aa5cSAndroid Build Coastguard Worker const std::string filename); 49*dfc6aa5cSAndroid Build Coastguard Worker 50*dfc6aa5cSAndroid Build Coastguard Worker // Returns true if the MD5 sum of the file at the given |path| matches that of 51*dfc6aa5cSAndroid Build Coastguard Worker // the |expected_md5|, false otherwise. 52*dfc6aa5cSAndroid Build Coastguard Worker bool CompareFileAndMD5(const base::FilePath& path, 53*dfc6aa5cSAndroid Build Coastguard Worker const std::string expected_md5); 54*dfc6aa5cSAndroid Build Coastguard Worker 55*dfc6aa5cSAndroid Build Coastguard Worker #endif // THIRD_PARTY_LIBJPEG_TURBO_GTEST_UTILS_H_ 56