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

Side by Side Diff: base/base_paths_mac.mm

Issue 10790008: Adds a way to specify test data files for unittests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use <(DEPTH). Created 8 years, 5 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
« no previous file with comments | « base/base.gyp ('k') | build/copy_test_data_ios.gypi » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/base_paths_mac.h" 5 #include "base/base_paths_mac.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #include <mach-o/dyld.h> 9 #include <mach-o/dyld.h>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return base::mac::GetUserDirectory(NSCachesDirectory, result); 61 return base::mac::GetUserDirectory(NSCachesDirectory, result);
62 case base::DIR_APP_DATA: 62 case base::DIR_APP_DATA:
63 return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result); 63 return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
64 case base::DIR_SOURCE_ROOT: { 64 case base::DIR_SOURCE_ROOT: {
65 // Go through PathService to catch overrides. 65 // Go through PathService to catch overrides.
66 if (!PathService::Get(base::FILE_EXE, result)) 66 if (!PathService::Get(base::FILE_EXE, result))
67 return false; 67 return false;
68 68
69 // Start with the executable's directory. 69 // Start with the executable's directory.
70 *result = result->DirName(); 70 *result = result->DirName();
71
72 #if !defined(OS_IOS)
71 if (base::mac::AmIBundled()) { 73 if (base::mac::AmIBundled()) {
72 // The bundled app executables (Chromium, TestShell, etc) live five 74 // The bundled app executables (Chromium, TestShell, etc) live five
73 // levels down, eg: 75 // levels down, eg:
74 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium 76 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium
75 *result = result->DirName().DirName().DirName().DirName().DirName(); 77 *result = result->DirName().DirName().DirName().DirName().DirName();
76 } else { 78 } else {
77 // Unit tests execute two levels deep from the source root, eg: 79 // Unit tests execute two levels deep from the source root, eg:
78 // src/xcodebuild/{Debug|Release}/base_unittests 80 // src/xcodebuild/{Debug|Release}/base_unittests
79 *result = result->DirName().DirName(); 81 *result = result->DirName().DirName();
80 } 82 }
83 #endif
81 return true; 84 return true;
82 } 85 }
83 default: 86 default:
84 return false; 87 return false;
85 } 88 }
86 } 89 }
87 90
88 } // namespace base 91 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | build/copy_test_data_ios.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698