Commit e85f7241 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

Fix skia::ConfigureTestFont() on mac to use correct path.

After crrev.com/632414 the test fonts were moved to the framework
bundle, but the code was still trying to load them from Content Shell
bundle.

Bug: 928459
Change-Id: I7be6ce7bb3fe42c9e6ce64f31d61582e7661d00f
Reviewed-on: https://chromium-review.googlesource.com/c/1481026Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634338}
parent b0090ef0
...@@ -7,30 +7,25 @@ ...@@ -7,30 +7,25 @@
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h"
#include "base/stl_util.h"
#include "base/strings/sys_string_conversions.h"
namespace skia { namespace skia {
void ConfigureTestFont() { void ConfigureTestFont() {
// Load font files in the resource folder. // Load font files in the resource folder.
static const char* const kFontFileNames[] = {"Ahem.TTF", static const char* const kFontFileNames[] = {"Ahem.ttf",
"ChromiumAATTest.ttf"}; "ChromiumAATTest.ttf"};
// mainBundle is Content Shell Helper.app. Go two levels up to find
// Content Shell.app. Due to DumpRenderTree injecting the font files into
// its direct dependents, it's not easily possible to put the ttf files into
// the helper's resource directory instead of the outer bundle's resource
// directory.
NSString* bundle = [base::mac::FrameworkBundle() bundlePath];
bundle = [bundle stringByAppendingPathComponent:@"../.."];
NSURL* resources_directory = [[NSBundle bundleWithPath:bundle] resourceURL];
NSMutableArray* font_urls = [NSMutableArray array]; NSMutableArray* font_urls = [NSMutableArray array];
for (unsigned i = 0; i < base::size(kFontFileNames); ++i) { for (unsigned i = 0; i < base::size(kFontFileNames); ++i) {
NSURL* font_url = [resources_directory base::ScopedCFTypeRef<CFStringRef> file_name(
URLByAppendingPathComponent: base::SysUTF8ToCFStringRef(kFontFileNames[i]));
[NSString stringWithUTF8String:kFontFileNames[i]]]; NSURL* font_url = base::mac::FilePathToNSURL(
base::mac::PathForFrameworkBundleResource(file_name));
[font_urls addObject:[font_url absoluteURL]]; [font_urls addObject:[font_url absoluteURL]];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment