OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <ApplicationServices/ApplicationServices.h> | 5 #include <ApplicationServices/ApplicationServices.h> |
6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
7 #import <objc/objc-runtime.h> | 7 #import <objc/objc-runtime.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "webkit/tools/test_shell/test_shell.h" | 10 #include "webkit/tools/test_shell/test_shell.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 [base::mac::FrameworkBundle() pathForResource:@"test_shell" | 216 [base::mac::FrameworkBundle() pathForResource:@"test_shell" |
217 ofType:@"pak"]; | 217 ofType:@"pak"]; |
218 FilePath resources_pak_path([resource_path fileSystemRepresentation]); | 218 FilePath resources_pak_path([resource_path fileSystemRepresentation]); |
219 if (!g_resource_data_pack->LoadFromPath(resources_pak_path)) { | 219 if (!g_resource_data_pack->LoadFromPath(resources_pak_path)) { |
220 LOG(FATAL) << "failed to load test_shell.pak"; | 220 LOG(FATAL) << "failed to load test_shell.pak"; |
221 } | 221 } |
222 | 222 |
223 ResetWebPreferences(); | 223 ResetWebPreferences(); |
224 | 224 |
225 // Load the Ahem font, which is used by layout tests. | 225 // Load the Ahem font, which is used by layout tests. |
226 const char* ahem_path_c; | |
227 NSString* ahem_path = [[base::mac::FrameworkBundle() resourcePath] | 226 NSString* ahem_path = [[base::mac::FrameworkBundle() resourcePath] |
228 stringByAppendingPathComponent:@"AHEM____.TTF"]; | 227 stringByAppendingPathComponent:@"AHEM____.TTF"]; |
229 ahem_path_c = [ahem_path fileSystemRepresentation]; | 228 NSURL* ahem_path_url = [NSURL fileURLWithPath:ahem_path]; |
230 FSRef ahem_fsref; | 229 CFErrorRef error; |
231 if (!base::mac::FSRefFromPath(ahem_path_c, &ahem_fsref)) { | 230 if (!CTFontManagerRegisterFontsForURL((CFURLRef)ahem_path_url, |
232 DLOG(FATAL) << "FSRefFromPath " << ahem_path_c; | 231 kCTFontManagerScopeProcess, &error)) { |
233 } else { | 232 DLOG(FATAL) << "CTFontManagerRegisterFontsForURL " |
234 // The last argument is an ATSFontContainerRef that can be passed to | 233 << [ahem_path fileSystemRepresentation] |
235 // ATSFontDeactivate to unload the font. Since the font is only loaded | 234 << [[(NSError*)error description] UTF8String]; |
236 // for this process, and it's always wanted, don't keep track of it. | |
237 if (ATSFontActivateFromFileReference(&ahem_fsref, | |
238 kATSFontContextLocal, | |
239 kATSFontFormatUnspecified, | |
240 NULL, | |
241 kATSOptionFlagsDefault, | |
242 NULL) != noErr) { | |
243 DLOG(FATAL) << "ATSFontActivateFromFileReference " << ahem_path_c; | |
244 } | |
245 } | 235 } |
246 | 236 |
247 // Add <app bundle's parent dir>/plugins to the plugin path so we can load | 237 // Add <app bundle's parent dir>/plugins to the plugin path so we can load |
248 // test plugins. | 238 // test plugins. |
249 FilePath plugins_dir; | 239 FilePath plugins_dir; |
250 PathService::Get(base::DIR_EXE, &plugins_dir); | 240 PathService::Get(base::DIR_EXE, &plugins_dir); |
251 if (base::mac::AmIBundled()) { | 241 if (base::mac::AmIBundled()) { |
252 plugins_dir = plugins_dir.AppendASCII("../../../plugins"); | 242 plugins_dir = plugins_dir.AppendASCII("../../../plugins"); |
253 } else { | 243 } else { |
254 plugins_dir = plugins_dir.AppendASCII("plugins"); | 244 plugins_dir = plugins_dir.AppendASCII("plugins"); |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 return false; | 685 return false; |
696 } | 686 } |
697 | 687 |
698 void DidLoadPlugin(const std::string& filename) { | 688 void DidLoadPlugin(const std::string& filename) { |
699 } | 689 } |
700 | 690 |
701 void DidUnloadPlugin(const std::string& filename) { | 691 void DidUnloadPlugin(const std::string& filename) { |
702 } | 692 } |
703 | 693 |
704 } // namespace webkit_glue | 694 } // namespace webkit_glue |
OLD | NEW |