| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 std::unique_ptr<base::MessagePump> CreateMessagePumpForUIStub() { | 130 std::unique_ptr<base::MessagePump> CreateMessagePumpForUIStub() { |
| 131 return std::unique_ptr<base::MessagePump>(new MessagePumpForUIStub()); | 131 return std::unique_ptr<base::MessagePump>(new MessagePumpForUIStub()); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 // Provides the test path for DIR_MODULE and DIR_ANDROID_APP_DATA. | 134 // Provides the test path for DIR_MODULE and DIR_ANDROID_APP_DATA. |
| 135 bool GetTestProviderPath(int key, base::FilePath* result) { | 135 bool GetTestProviderPath(int key, base::FilePath* result) { |
| 136 switch (key) { | 136 switch (key) { |
| 137 case base::DIR_ANDROID_APP_DATA: { | 137 case base::DIR_ANDROID_APP_DATA: { |
| 138 // For tests, app data is put in external storage. | 138 // For tests, app data is put in external storage. |
| 139 return base::android::GetExternalStorageDirectory(result); | 139 return PathService::Get(base::DIR_SOURCE_ROOT, result); |
| 140 } | 140 } |
| 141 default: | 141 default: |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 void InitPathProvider(int key) { | 146 void InitPathProvider(int key) { |
| 147 base::FilePath path; | 147 base::FilePath path; |
| 148 // If failed to override the key, that means the way has not been registered. | 148 // If failed to override the key, that means the way has not been registered. |
| 149 if (GetTestProviderPath(key, &path) && !PathService::Override(key, path)) | 149 if (GetTestProviderPath(key, &path) && !PathService::Override(key, path)) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 174 if (!MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub)) | 174 if (!MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub)) |
| 175 LOG(INFO) << "MessagePumpForUIFactory already set, unable to override."; | 175 LOG(INFO) << "MessagePumpForUIFactory already set, unable to override."; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void InitAndroidTest() { | 178 void InitAndroidTest() { |
| 179 InitAndroidTestLogging(); | 179 InitAndroidTestLogging(); |
| 180 InitAndroidTestPaths(); | 180 InitAndroidTestPaths(); |
| 181 InitAndroidTestMessageLoop(); | 181 InitAndroidTestMessageLoop(); |
| 182 } | 182 } |
| 183 } // namespace base | 183 } // namespace base |
| OLD | NEW |