| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 window_list_ = new WindowList; | 174 window_list_ = new WindowList; |
| 175 layout_test_mode_ = layout_test_mode; | 175 layout_test_mode_ = layout_test_mode; |
| 176 | 176 |
| 177 web_prefs_ = new WebPreferences; | 177 web_prefs_ = new WebPreferences; |
| 178 | 178 |
| 179 ResetWebPreferences(); | 179 ResetWebPreferences(); |
| 180 | 180 |
| 181 // Load the Ahem font, which is used by layout tests. | 181 // Load the Ahem font, which is used by layout tests. |
| 182 const char* ahem_path_c; | 182 const char* ahem_path_c; |
| 183 FilePath ahem_path; // Ensure ahem_path_c storage is not freed too soon. | 183 NSString* ahem_path = [[mac_util::MainAppBundle() resourcePath] |
| 184 if (mac_util::AmIBundled()) { | 184 stringByAppendingPathComponent:@"AHEM____.TTF"]; |
| 185 // When bundled (in TestShell.app), expect to find the font in | 185 ahem_path_c = [ahem_path fileSystemRepresentation]; |
| 186 // Contents/Resources. | |
| 187 NSString* ahem_path = [[[NSBundle mainBundle] resourcePath] | |
| 188 stringByAppendingPathComponent:@"AHEM____.TTF"]; | |
| 189 ahem_path_c = [ahem_path fileSystemRepresentation]; | |
| 190 } else { | |
| 191 // When not bundled (in test_shell_tests), look in the source tree for | |
| 192 // the font. | |
| 193 PathService::Get(base::DIR_SOURCE_ROOT, &ahem_path); | |
| 194 ahem_path = ahem_path.Append("webkit"); | |
| 195 ahem_path = ahem_path.Append("tools"); | |
| 196 ahem_path = ahem_path.Append("test_shell"); | |
| 197 ahem_path = ahem_path.Append("resources"); | |
| 198 ahem_path = ahem_path.Append("AHEM____.TTF"); | |
| 199 | |
| 200 ahem_path_c = ahem_path.value().c_str(); | |
| 201 } | |
| 202 | |
| 203 FSRef ahem_fsref; | 186 FSRef ahem_fsref; |
| 204 if (!mac_util::FSRefFromPath(ahem_path_c, &ahem_fsref)) { | 187 if (!mac_util::FSRefFromPath(ahem_path_c, &ahem_fsref)) { |
| 205 DLOG(FATAL) << "FSRefFromPath " << ahem_path_c; | 188 DLOG(FATAL) << "FSRefFromPath " << ahem_path_c; |
| 206 } else { | 189 } else { |
| 207 // The last argument is an ATSFontContainerRef that can be passed to | 190 // The last argument is an ATSFontContainerRef that can be passed to |
| 208 // ATSFontDeactivate to unload the font. Since the font is only loaded | 191 // ATSFontDeactivate to unload the font. Since the font is only loaded |
| 209 // for this process, and it's always wanted, don't keep track of it. | 192 // for this process, and it's always wanted, don't keep track of it. |
| 210 if (ATSFontActivateFromFileReference(&ahem_fsref, | 193 if (ATSFontActivateFromFileReference(&ahem_fsref, |
| 211 kATSFontContextLocal, | 194 kATSFontContextLocal, |
| 212 kATSFontFormatUnspecified, | 195 kATSFontFormatUnspecified, |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 return false; | 678 return false; |
| 696 } | 679 } |
| 697 | 680 |
| 698 void DidLoadPlugin(const std::string& filename) { | 681 void DidLoadPlugin(const std::string& filename) { |
| 699 } | 682 } |
| 700 | 683 |
| 701 void DidUnloadPlugin(const std::string& filename) { | 684 void DidUnloadPlugin(const std::string& filename) { |
| 702 } | 685 } |
| 703 | 686 |
| 704 } // namespace webkit_glue | 687 } // namespace webkit_glue |
| OLD | NEW |