| 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/android/path_utils.h" | 8 #include "base/android/path_utils.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 base::MessagePump* CreateMessagePumpForUIStub() { | 137 base::MessagePump* CreateMessagePumpForUIStub() { |
| 138 return new MessagePumpForUIStub(); | 138 return new MessagePumpForUIStub(); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 // Provides the test path for DIR_MODULE and DIR_ANDROID_APP_DATA. | 141 // Provides the test path for DIR_MODULE and DIR_ANDROID_APP_DATA. |
| 142 bool GetTestProviderPath(int key, FilePath* result) { | 142 bool GetTestProviderPath(int key, FilePath* result) { |
| 143 switch (key) { | 143 switch (key) { |
| 144 case base::DIR_MODULE: { | 144 case base::DIR_MODULE: { |
| 145 *result = FilePath(base::android::GetExternalStorageDirectory()); | 145 return base::android::GetExternalStorageDirectory(result); |
| 146 return true; | |
| 147 } | 146 } |
| 148 case base::DIR_ANDROID_APP_DATA: { | 147 case base::DIR_ANDROID_APP_DATA: { |
| 149 // For tests, app data is put in external storage. | 148 // For tests, app data is put in external storage. |
| 150 *result = FilePath(base::android::GetExternalStorageDirectory()); | 149 return base::android::GetExternalStorageDirectory(result); |
| 151 return true; | |
| 152 } | 150 } |
| 153 default: | 151 default: |
| 154 return false; | 152 return false; |
| 155 } | 153 } |
| 156 } | 154 } |
| 157 | 155 |
| 158 void InitPathProvider(int key) { | 156 void InitPathProvider(int key) { |
| 159 FilePath path; | 157 FilePath path; |
| 160 // If failed to override the key, that means the way has not been registered. | 158 // If failed to override the key, that means the way has not been registered. |
| 161 if (GetTestProviderPath(key, &path) && !PathService::Override(key, path)) | 159 if (GetTestProviderPath(key, &path) && !PathService::Override(key, path)) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 187 void InitAndroidTestMessageLoop() { | 185 void InitAndroidTestMessageLoop() { |
| 188 MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub); | 186 MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub); |
| 189 } | 187 } |
| 190 | 188 |
| 191 void InitAndroidTest() { | 189 void InitAndroidTest() { |
| 192 InitAndroidTestLogging(); | 190 InitAndroidTestLogging(); |
| 193 InitAndroidTestPaths(); | 191 InitAndroidTestPaths(); |
| 194 InitAndroidTestMessageLoop(); | 192 InitAndroidTestMessageLoop(); |
| 195 } | 193 } |
| 196 } // namespace base | 194 } // namespace base |
| OLD | NEW |