Add CefScopedTempDir and file utility functions for unit tests (issue #1632)

This commit is contained in:
Marshall Greenblatt
2016-11-15 12:56:02 -05:00
parent a7195c0103
commit 04642e0480
22 changed files with 1539 additions and 194 deletions

View File

@@ -12,6 +12,8 @@
#include "include/cef_app.h"
#include "include/capi/cef_app_capi.h"
#include "include/cef_file_util.h"
#include "include/capi/cef_file_util_capi.h"
#include "include/cef_geolocation.h"
#include "include/capi/cef_geolocation_capi.h"
#include "include/cef_origin_whitelist.h"
@@ -379,6 +381,124 @@ CEF_GLOBAL void CefEnableHighDPISupport() {
cef_enable_highdpi_support();
}
CEF_GLOBAL bool CefCreateDirectory(const CefString& full_path) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: full_path; type: string_byref_const
DCHECK(!full_path.empty());
if (full_path.empty())
return false;
// Execute
int _retval = cef_create_directory(
full_path.GetStruct());
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefGetTempDirectory(CefString& temp_dir) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = cef_get_temp_directory(
temp_dir.GetWritableStruct());
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefCreateNewTempDirectory(const CefString& prefix,
CefString& new_temp_path) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: prefix
// Execute
int _retval = cef_create_new_temp_directory(
prefix.GetStruct(),
new_temp_path.GetWritableStruct());
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefCreateTempDirectoryInDirectory(const CefString& base_dir,
const CefString& prefix, CefString& new_dir) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: base_dir; type: string_byref_const
DCHECK(!base_dir.empty());
if (base_dir.empty())
return false;
// Unverified params: prefix
// Execute
int _retval = cef_create_temp_directory_in_directory(
base_dir.GetStruct(),
prefix.GetStruct(),
new_dir.GetWritableStruct());
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefDirectoryExists(const CefString& path) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: path; type: string_byref_const
DCHECK(!path.empty());
if (path.empty())
return false;
// Execute
int _retval = cef_directory_exists(
path.GetStruct());
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefDeleteFile(const CefString& path, bool recursive) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: path; type: string_byref_const
DCHECK(!path.empty());
if (path.empty())
return false;
// Execute
int _retval = cef_delete_file(
path.GetStruct(),
recursive);
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefZipDirectory(const CefString& src_dir,
const CefString& dest_file, bool include_hidden_files) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: src_dir; type: string_byref_const
DCHECK(!src_dir.empty());
if (src_dir.empty())
return false;
// Verify param: dest_file; type: string_byref_const
DCHECK(!dest_file.empty());
if (dest_file.empty())
return false;
// Execute
int _retval = cef_zip_directory(
src_dir.GetStruct(),
dest_file.GetStruct(),
include_hidden_files);
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefGetGeolocation(
CefRefPtr<CefGetGeolocationCallback> callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING