Revert of Reland of Move side-loaded test data /sdcard -> /sdcard/gtestdata (patchset #3 id:300001 of https://codereview.chromium.org/2018663002/ )
Reason for revert:
Breaking quota-related tests in content_browsertests
https://crbug.com/617213
Original issue's description:
> Reland of Move side-loaded test data /sdcard -> /sdcard/chromium_tests_root
>
> Reason for reland:
> Updated webview tests that broke (WebViewLayoutTest.java)
>
> And use delete_device_stale=True when pushing. This will prevent tests
> mistakenly passing when they depend on stale data files from a previous test.
>
> TBR=jbudorick@chromium.org,thakis@chromium.org,mef@chromium.org
> BUG=607169
>
> Committed: https://crrev.com/2524a0db714a44fbce723e00f6ed914e6d143cb6
> Cr-Commit-Position: refs/heads/master@{#396479}
TBR=jbudorick@chromium.org,thakis@chromium.org,mef@chromium.org,torne@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=607169,617213,616155
Review-Url: https://codereview.chromium.org/2044523003
Cr-Commit-Position: refs/heads/master@{#398137}
CrOS-Libchrome-Original-Commit: 55ff9438e11da5a78a6ba5d100cebfcfdbc07deb
diff --git a/base/base_paths_android.cc b/base/base_paths_android.cc
index 8a400e5..ca58179 100644
--- a/base/base_paths_android.cc
+++ b/base/base_paths_android.cc
@@ -38,10 +38,8 @@
case base::DIR_MODULE:
return base::android::GetNativeLibraryDirectory(result);
case base::DIR_SOURCE_ROOT:
- // Used only by tests.
- // In that context, hooked up via base/test/test_support_android.cc.
- NOTIMPLEMENTED();
- return false;
+ // This const is only used for tests.
+ return base::android::GetExternalStorageDirectory(result);
case base::DIR_USER_DESKTOP:
// Android doesn't support GetUserDesktop.
NOTIMPLEMENTED();
diff --git a/base/test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java b/base/test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java
index 7433d8e..797585f 100644
--- a/base/test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java
+++ b/base/test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java
@@ -20,7 +20,7 @@
*/
public static String getTestFilePath(String path) {
// TODO(jbudorick): Remove DATA_DIR once everything has been isolated. crbug/400499
- return getIsolatedTestFilePath(DATA_DIR + path);
+ return PathUtils.getExternalStorageDirectory() + DATA_DIR + path;
}
// TODO(jbudorick): Remove this function once everything has been isolated and switched back
@@ -30,14 +30,7 @@
* @param path Pathname relative to external/
*/
public static String getIsolatedTestFilePath(String path) {
- return getIsolatedTestRoot() + "/" + path;
- }
-
- /**
- * Returns the root of the test data directory.
- */
- public static String getIsolatedTestRoot() {
- return PathUtils.getExternalStorageDirectory() + "/chromium_tests_root";
+ return PathUtils.getExternalStorageDirectory() + "/" + path;
}
/**
diff --git a/base/test/test_support_android.cc b/base/test/test_support_android.cc
index 4507ae4..f8441bd 100644
--- a/base/test/test_support_android.cc
+++ b/base/test/test_support_android.cc
@@ -18,8 +18,6 @@
namespace {
-base::FilePath* g_test_data_dir = nullptr;
-
struct RunState {
RunState(base::MessagePump::Delegate* delegate, int run_depth)
: delegate(delegate),
@@ -134,14 +132,13 @@
return std::unique_ptr<base::MessagePump>(new MessagePumpForUIStub());
};
-// Provides the test path for DIR_SOURCE_ROOT and DIR_ANDROID_APP_DATA.
+// Provides the test path for DIR_MODULE and DIR_ANDROID_APP_DATA.
bool GetTestProviderPath(int key, base::FilePath* result) {
switch (key) {
- case base::DIR_ANDROID_APP_DATA:
- case base::DIR_SOURCE_ROOT:
- CHECK(g_test_data_dir != nullptr);
- *result = *g_test_data_dir;
- return true;
+ case base::DIR_ANDROID_APP_DATA: {
+ // For tests, app data is put in external storage.
+ return base::android::GetExternalStorageDirectory(result);
+ }
default:
return false;
}
@@ -169,13 +166,8 @@
false); // Tick count
}
-void InitAndroidTestPaths(const FilePath& test_data_dir) {
- if (g_test_data_dir) {
- CHECK(test_data_dir == *g_test_data_dir);
- return;
- }
- g_test_data_dir = new FilePath(test_data_dir);
- InitPathProvider(DIR_SOURCE_ROOT);
+void InitAndroidTestPaths() {
+ InitPathProvider(DIR_MODULE);
InitPathProvider(DIR_ANDROID_APP_DATA);
}
@@ -187,6 +179,7 @@
void InitAndroidTest() {
if (!base::AndroidIsChildProcess()) {
InitAndroidTestLogging();
+ InitAndroidTestPaths();
}
InitAndroidTestMessageLoop();
}
diff --git a/base/test/test_support_android.h b/base/test/test_support_android.h
index f4d64b4..062785e 100644
--- a/base/test/test_support_android.h
+++ b/base/test/test_support_android.h
@@ -9,13 +9,11 @@
namespace base {
-class FilePath;
-
// Init logging for tests on Android. Logs will be output into Android's logcat.
BASE_EXPORT void InitAndroidTestLogging();
// Init path providers for tests on Android.
-BASE_EXPORT void InitAndroidTestPaths(const FilePath& test_data_dir);
+BASE_EXPORT void InitAndroidTestPaths();
// Init the message loop for tests on Android.
BASE_EXPORT void InitAndroidTestMessageLoop();