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 <stdarg.h> | 5 #include <stdarg.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 }; | 131 }; |
132 | 132 |
133 // Provides the test path for DIR_MODULE, DIR_CACHE and DIR_ANDROID_APP_DATA. | 133 // Provides the test path for DIR_MODULE, DIR_CACHE and DIR_ANDROID_APP_DATA. |
134 bool PathTestProviderAndroid(int key, FilePath* result) { | 134 bool PathTestProviderAndroid(int key, FilePath* result) { |
135 switch (key) { | 135 switch (key) { |
136 case base::DIR_MODULE: { | 136 case base::DIR_MODULE: { |
137 *result = FilePath(kAndroidTestTempDirectory); | 137 *result = FilePath(kAndroidTestTempDirectory); |
138 return true; | 138 return true; |
139 } | 139 } |
| 140 #if !defined(ANDROID_APK_TEST_TARGET) |
| 141 // When running as executable we need to use /data/local/tmp as the |
| 142 // cache directory. |
140 case base::DIR_CACHE: { | 143 case base::DIR_CACHE: { |
141 *result = FilePath(kAndroidTestTempDirectory); | 144 *result = FilePath(kAndroidTestTempDirectory); |
142 return true; | 145 return true; |
143 } | 146 } |
| 147 #endif // !defined(ANDROID_APK_TEST_TARGET) |
144 case base::DIR_ANDROID_APP_DATA: { | 148 case base::DIR_ANDROID_APP_DATA: { |
145 *result = FilePath(kAndroidTestTempDirectory); | 149 *result = FilePath(kAndroidTestTempDirectory); |
146 return true; | 150 return true; |
147 } | 151 } |
148 default: | 152 default: |
149 return false; | 153 return false; |
150 } | 154 } |
151 } | 155 } |
152 | 156 |
153 // The factory method to create a MessagePumpForUI. | 157 // The factory method to create a MessagePumpForUI. |
(...skipping 24 matching lines...) Expand all Loading... |
178 | 182 |
179 PathService::RegisterProvider(&PathTestProviderAndroid, base::DIR_MODULE, | 183 PathService::RegisterProvider(&PathTestProviderAndroid, base::DIR_MODULE, |
180 base::DIR_MODULE + 1); | 184 base::DIR_MODULE + 1); |
181 PathService::RegisterProvider(&PathTestProviderAndroid, base::DIR_CACHE, | 185 PathService::RegisterProvider(&PathTestProviderAndroid, base::DIR_CACHE, |
182 base::DIR_CACHE + 1); | 186 base::DIR_CACHE + 1); |
183 PathService::RegisterProvider(&PathTestProviderAndroid, | 187 PathService::RegisterProvider(&PathTestProviderAndroid, |
184 base::DIR_ANDROID_APP_DATA, base::DIR_ANDROID_APP_DATA + 1); | 188 base::DIR_ANDROID_APP_DATA, base::DIR_ANDROID_APP_DATA + 1); |
185 | 189 |
186 MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub); | 190 MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub); |
187 } | 191 } |
OLD | NEW |