Index: content/shell/app/webkit_test_platform_support_linux.cc |
diff --git a/content/shell/app/webkit_test_platform_support_linux.cc b/content/shell/app/webkit_test_platform_support_linux.cc |
index 3b04631ff62dac43eb14c1cbb66e59f7ec462f91..8f9fe91c50c98dbec471fc0ea562393b793e97d9 100644 |
--- a/content/shell/app/webkit_test_platform_support_linux.cc |
+++ b/content/shell/app/webkit_test_platform_support_linux.cc |
@@ -11,6 +11,7 @@ |
#include "base/files/file_path.h" |
#include "base/files/file_path.h" |
+#include "base/logging.h" |
#include "base/path_service.h" |
namespace content { |
@@ -23,21 +24,40 @@ bool CheckAndLoadFontFile( |
if (access(font, R_OK) < 0) { |
font = path2; |
if (access(font, R_OK) < 0) { |
- std::cerr << "You are missing " << path1 << " or " << path2 << ". " |
- << "Without this, some layout tests may fail. See " |
- << "http://code.google.com/p/chromium/wiki/LayoutTestsLinux " |
- << "for more.\n"; |
+ LOG(WARNING) << "You are missing " << path1 << " or " << path2 << ". " |
+ << "Without this, some layout tests may fail. See " |
+ << "http://code.google.com/p/chromium/wiki/LayoutTestsLinux " |
+ << "for more.\n"; |
return false; |
} |
} |
if (!FcConfigAppFontAddFile( |
fontcfg, reinterpret_cast<const FcChar8*>(font))) { |
- std::cerr << "Failed to load font " << font << "\n"; |
+ LOG(ERROR) << "Failed to load font " << font << "\n"; |
return false; |
} |
return true; |
} |
+static bool LoadFontResources(const base::FilePath& base_path, |
+ FcConfig* font_config) { |
+ const char* const own_fonts[] = {"AHEM____.TTF", "GardinerModBug.ttf", |
+ "GardinerModCat.ttf"}; |
+ |
+ for (size_t i = 0; i < arraysize(own_fonts); ++i) { |
+ base::FilePath font_path = base_path.Append(own_fonts[i]); |
+ if (access(font_path.value().c_str(), R_OK) < 0 || |
+ !FcConfigAppFontAddFile( |
+ font_config, |
+ reinterpret_cast<const FcChar8*>(font_path.value().c_str()))) { |
+ LOG(ERROR) << "Failed to load test font resource " |
+ << font_path.value().c_str() << ".\n"; |
+ return false; |
+ } |
+ } |
+ return true; |
+} |
+ |
const char* const kFonts[] = { |
"/usr/share/fonts/truetype/kochi/kochi-gothic.ttf", |
"/usr/share/fonts/truetype/kochi/kochi-mincho.ttf", |
@@ -87,20 +107,20 @@ bool SetupFontConfig() { |
font_config, |
reinterpret_cast<const FcChar8*>(fonts_conf.value().c_str()), |
true)) { |
- std::cerr << "Failed to parse fontconfig config file\n"; |
+ LOG(ERROR) << "Failed to parse fontconfig config file\n"; |
return false; |
} |
for (size_t i = 0; i < arraysize(kFonts); ++i) { |
if (access(kFonts[i], R_OK) < 0) { |
- std::cerr << "You are missing " << kFonts[i] << ". Try re-running " |
- << "build/install-build-deps.sh. Also see " |
- << "http://code.google.com/p/chromium/wiki/LayoutTestsLinux"; |
+ LOG(ERROR) << "You are missing " << kFonts[i] << ". Try re-running " |
+ << "build/install-build-deps.sh. Also see " |
+ << "http://code.google.com/p/chromium/wiki/LayoutTestsLinux"; |
return false; |
} |
if (!FcConfigAppFontAddFile( |
font_config, reinterpret_cast<const FcChar8*>(kFonts[i]))) { |
- std::cerr << "Failed to load font " << kFonts[i] << "\n"; |
+ LOG(ERROR) << "Failed to load font " << kFonts[i] << "\n"; |
return false; |
} |
} |
@@ -119,16 +139,11 @@ bool SetupFontConfig() { |
"/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf", |
"/usr/share/fonts/truetype/ttf-punjabi-fonts/lohit_pa.ttf"); |
- base::FilePath ahem_font = base_path.Append("AHEM____.TTF"); |
- if (!FcConfigAppFontAddFile( |
- font_config, |
- reinterpret_cast<const FcChar8*>(ahem_font.value().c_str()))) { |
- std::cerr << "Failed to load font " << ahem_font.value() << "\n"; |
+ if (!LoadFontResources(base_path, font_config)) |
return false; |
- } |
if (!FcConfigSetCurrent(font_config)) { |
- std::cerr << "Failed to set the default font configuration\n"; |
+ LOG(ERROR) << "Failed to set the default font configuration\n"; |
return false; |
} |