Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: webkit/tools/test_shell/test_shell_mac.mm

Issue 6046009: Move base/mac_util.h to base/mac and use the base::mac namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/test_shell.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 #include "app/data_pack.h" 12 #include "app/data_pack.h"
13 #include "base/base_paths.h" 13 #include "base/base_paths.h"
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/debug_on_start.h" 15 #include "base/debug_on_start.h"
16 #include "base/debug/debugger.h" 16 #include "base/debug/debugger.h"
17 #include "base/file_path.h" 17 #include "base/file_path.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/mac_util.h" 20 #include "base/mac/mac_util.h"
21 #include "base/memory_debug.h" 21 #include "base/memory_debug.h"
22 #include "base/message_loop.h" 22 #include "base/message_loop.h"
23 #include "base/path_service.h" 23 #include "base/path_service.h"
24 #include "base/string16.h" 24 #include "base/string16.h"
25 #include "base/string_piece.h" 25 #include "base/string_piece.h"
26 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
27 #include "gfx/size.h" 27 #include "gfx/size.h"
28 #include "grit/webkit_resources.h" 28 #include "grit/webkit_resources.h"
29 #include "net/base/mime_util.h" 29 #include "net/base/mime_util.h"
30 #include "skia/ext/bitmap_platform_device.h" 30 #include "skia/ext/bitmap_platform_device.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static app::DataPack* g_resource_data_pack = NULL; 73 static app::DataPack* g_resource_data_pack = NULL;
74 74
75 // Define static member variables 75 // Define static member variables
76 base::LazyInstance <std::map<gfx::NativeWindow, TestShell *> > 76 base::LazyInstance <std::map<gfx::NativeWindow, TestShell *> >
77 TestShell::window_map_(base::LINKER_INITIALIZED); 77 TestShell::window_map_(base::LINKER_INITIALIZED);
78 78
79 // Helper method for getting the path to the test shell resources directory. 79 // Helper method for getting the path to the test shell resources directory.
80 FilePath GetResourcesFilePath() { 80 FilePath GetResourcesFilePath() {
81 FilePath path; 81 FilePath path;
82 // We need to know if we're bundled or not to know which path to use. 82 // We need to know if we're bundled or not to know which path to use.
83 if (mac_util::AmIBundled()) { 83 if (base::mac::AmIBundled()) {
84 PathService::Get(base::DIR_EXE, &path); 84 PathService::Get(base::DIR_EXE, &path);
85 path = path.Append(FilePath::kParentDirectory); 85 path = path.Append(FilePath::kParentDirectory);
86 return path.AppendASCII("Resources"); 86 return path.AppendASCII("Resources");
87 } else { 87 } else {
88 PathService::Get(base::DIR_SOURCE_ROOT, &path); 88 PathService::Get(base::DIR_SOURCE_ROOT, &path);
89 path = path.AppendASCII("webkit"); 89 path = path.AppendASCII("webkit");
90 path = path.AppendASCII("tools"); 90 path = path.AppendASCII("tools");
91 path = path.AppendASCII("test_shell"); 91 path = path.AppendASCII("test_shell");
92 return path.AppendASCII("resources"); 92 return path.AppendASCII("resources");
93 } 93 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 layout_test_mode_ = layout_test_mode; 205 layout_test_mode_ = layout_test_mode;
206 allow_external_pages_ = allow_external_pages; 206 allow_external_pages_ = allow_external_pages;
207 207
208 web_prefs_ = new WebPreferences; 208 web_prefs_ = new WebPreferences;
209 209
210 // mmap the data pack which holds strings used by WebCore. This is only 210 // mmap the data pack which holds strings used by WebCore. This is only
211 // a fatal error if we're bundled, which means we might be running layout 211 // a fatal error if we're bundled, which means we might be running layout
212 // tests. This is a harmless failure for test_shell_tests. 212 // tests. This is a harmless failure for test_shell_tests.
213 g_resource_data_pack = new app::DataPack; 213 g_resource_data_pack = new app::DataPack;
214 NSString *resource_path = 214 NSString *resource_path =
215 [mac_util::MainAppBundle() pathForResource:@"test_shell" 215 [base::mac::MainAppBundle() pathForResource:@"test_shell"
216 ofType:@"pak"]; 216 ofType:@"pak"];
217 FilePath resources_pak_path([resource_path fileSystemRepresentation]); 217 FilePath resources_pak_path([resource_path fileSystemRepresentation]);
218 if (!g_resource_data_pack->Load(resources_pak_path)) { 218 if (!g_resource_data_pack->Load(resources_pak_path)) {
219 LOG(FATAL) << "failed to load test_shell.pak"; 219 LOG(FATAL) << "failed to load test_shell.pak";
220 } 220 }
221 221
222 ResetWebPreferences(); 222 ResetWebPreferences();
223 223
224 // Load the Ahem font, which is used by layout tests. 224 // Load the Ahem font, which is used by layout tests.
225 const char* ahem_path_c; 225 const char* ahem_path_c;
226 NSString* ahem_path = [[mac_util::MainAppBundle() resourcePath] 226 NSString* ahem_path = [[base::mac::MainAppBundle() resourcePath]
227 stringByAppendingPathComponent:@"AHEM____.TTF"]; 227 stringByAppendingPathComponent:@"AHEM____.TTF"];
228 ahem_path_c = [ahem_path fileSystemRepresentation]; 228 ahem_path_c = [ahem_path fileSystemRepresentation];
229 FSRef ahem_fsref; 229 FSRef ahem_fsref;
230 if (!mac_util::FSRefFromPath(ahem_path_c, &ahem_fsref)) { 230 if (!base::mac::FSRefFromPath(ahem_path_c, &ahem_fsref)) {
231 DLOG(FATAL) << "FSRefFromPath " << ahem_path_c; 231 DLOG(FATAL) << "FSRefFromPath " << ahem_path_c;
232 } else { 232 } else {
233 // The last argument is an ATSFontContainerRef that can be passed to 233 // The last argument is an ATSFontContainerRef that can be passed to
234 // ATSFontDeactivate to unload the font. Since the font is only loaded 234 // ATSFontDeactivate to unload the font. Since the font is only loaded
235 // for this process, and it's always wanted, don't keep track of it. 235 // for this process, and it's always wanted, don't keep track of it.
236 if (ATSFontActivateFromFileReference(&ahem_fsref, 236 if (ATSFontActivateFromFileReference(&ahem_fsref,
237 kATSFontContextLocal, 237 kATSFontContextLocal,
238 kATSFontFormatUnspecified, 238 kATSFontFormatUnspecified,
239 NULL, 239 NULL,
240 kATSOptionFlagsDefault, 240 kATSOptionFlagsDefault,
241 NULL) != noErr) { 241 NULL) != noErr) {
242 DLOG(FATAL) << "ATSFontActivateFromFileReference " << ahem_path_c; 242 DLOG(FATAL) << "ATSFontActivateFromFileReference " << ahem_path_c;
243 } 243 }
244 } 244 }
245 245
246 // Add <app bundle's parent dir>/plugins to the plugin path so we can load 246 // Add <app bundle's parent dir>/plugins to the plugin path so we can load
247 // test plugins. 247 // test plugins.
248 FilePath plugins_dir; 248 FilePath plugins_dir;
249 PathService::Get(base::DIR_EXE, &plugins_dir); 249 PathService::Get(base::DIR_EXE, &plugins_dir);
250 if (mac_util::AmIBundled()) { 250 if (base::mac::AmIBundled()) {
251 plugins_dir = plugins_dir.AppendASCII("../../../plugins"); 251 plugins_dir = plugins_dir.AppendASCII("../../../plugins");
252 } else { 252 } else {
253 plugins_dir = plugins_dir.AppendASCII("plugins"); 253 plugins_dir = plugins_dir.AppendASCII("plugins");
254 } 254 }
255 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(plugins_dir); 255 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(plugins_dir);
256 } 256 }
257 257
258 NSButton* MakeTestButton(NSRect* rect, NSString* title, NSView* parent) { 258 NSButton* MakeTestButton(NSRect* rect, NSString* title, NSView* parent) {
259 NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease]; 259 NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease];
260 [button setTitle:title]; 260 [button setTitle:title];
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 return false; 735 return false;
736 } 736 }
737 737
738 void DidLoadPlugin(const std::string& filename) { 738 void DidLoadPlugin(const std::string& filename) {
739 } 739 }
740 740
741 void DidUnloadPlugin(const std::string& filename) { 741 void DidUnloadPlugin(const std::string& filename) {
742 } 742 }
743 743
744 } // namespace webkit_glue 744 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_shell.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698