def testExceptionIfNoBuildGnFilesAreFound(self): with self.assertRaises(check_orphan_headers.NoBuildGnFoundError): file_path = _GetPath('home', 'projects', 'webrtc', 'base', 'foo.h') file_exists = lambda p: False src_dir_path = _GetPath('home', 'projects', 'webrtc') check_orphan_headers.GetBuildGnPathFromFilePath( file_path, file_exists, src_dir_path)
def testExceptionIfFilePathIsNotAnHeader(self): with self.assertRaises(check_orphan_headers.WrongFileTypeError): file_path = _GetPath('home', 'projects', 'webrtc', 'base', 'foo.cc') file_exists = lambda p: False src_dir_path = _GetPath('home', 'projects', 'webrtc') check_orphan_headers.GetBuildGnPathFromFilePath( file_path, file_exists, src_dir_path)
def testGetBuildPathFromParentDirectory(self): file_path = _GetPath('home', 'projects', 'webrtc', 'base', 'foo.h') expected_build_path = _GetPath('home', 'projects', 'webrtc', 'BUILD.gn') file_exists = lambda p: p == _GetPath('home', 'projects', 'webrtc', 'BUILD.gn') src_dir_path = _GetPath('home', 'projects', 'webrtc') self.assertEqual( expected_build_path, check_orphan_headers.GetBuildGnPathFromFilePath( file_path, file_exists, src_dir_path))