diff --git a/espresso/core/javatests/androidx/test/espresso/action/EspressoActionsWithTestFlowTest.java b/espresso/core/javatests/androidx/test/espresso/action/EspressoActionsWithTestFlowTest.java index 713b95a59..e3b19b91a 100644 --- a/espresso/core/javatests/androidx/test/espresso/action/EspressoActionsWithTestFlowTest.java +++ b/espresso/core/javatests/androidx/test/espresso/action/EspressoActionsWithTestFlowTest.java @@ -87,7 +87,7 @@ public void clickActionTestingOfTestFlowOutput() throws IOException { assertThat(testFlowVisualizer.getLastActionIndexAndIncrement()).isEqualTo(2); InputStream outputGalleryFile = TestStorageUtil.getInputStream( - PlatformTestStorageRegistry.getInstance().getOutputFileUri2("output_gallery.html"), + PlatformTestStorageRegistry.getInstance().getOutputFileUri("output_gallery.html"), InstrumentationRegistry.getInstrumentation().getTargetContext().getContentResolver()); int size = outputGalleryFile.available(); byte[] directFileContents = new byte[size]; @@ -129,8 +129,7 @@ public void testFlowVisualizerIfFeatureIsOffShowBreakage() { FileNotFoundException.class, () -> TestStorageUtil.getInputStream( - PlatformTestStorageRegistry.getInstance() - .getOutputFileUri2("output_gallery.html"), + PlatformTestStorageRegistry.getInstance().getOutputFileUri("output_gallery.html"), InstrumentationRegistry.getInstrumentation() .getTargetContext() .getContentResolver())); diff --git a/espresso/core/javatests/androidx/test/espresso/base/DefaultFailureHandlerTest.java b/espresso/core/javatests/androidx/test/espresso/base/DefaultFailureHandlerTest.java index 715ac87ca..9ae8af739 100644 --- a/espresso/core/javatests/androidx/test/espresso/base/DefaultFailureHandlerTest.java +++ b/espresso/core/javatests/androidx/test/espresso/base/DefaultFailureHandlerTest.java @@ -116,7 +116,7 @@ public void screenshotSaved() throws IOException { } private Bitmap readBitmapFromTestStorage(String pathName) throws IOException { - Uri outputFileUri = PlatformTestStorageRegistry.getInstance().getOutputFileUri2(pathName); + Uri outputFileUri = PlatformTestStorageRegistry.getInstance().getOutputFileUri(pathName); try (InputStream input = TestStorageUtil.getInputStream( outputFileUri, getApplicationContext().getContentResolver())) { diff --git a/espresso/core/javatests/androidx/test/espresso/internal/data/TestFlowVisualizerTest.java b/espresso/core/javatests/androidx/test/espresso/internal/data/TestFlowVisualizerTest.java index 4adf2e934..9dce9f894 100644 --- a/espresso/core/javatests/androidx/test/espresso/internal/data/TestFlowVisualizerTest.java +++ b/espresso/core/javatests/androidx/test/espresso/internal/data/TestFlowVisualizerTest.java @@ -69,7 +69,7 @@ public void testFlowVisualizerEnsureCorrectOutputForSingleDummyAction() throws I testFlowVisualizer.visualize(); InputStream outputGalleryFile = TestStorageUtil.getInputStream( - PlatformTestStorageRegistry.getInstance().getOutputFileUri2("output_gallery.html"), + PlatformTestStorageRegistry.getInstance().getOutputFileUri("output_gallery.html"), InstrumentationRegistry.getInstrumentation().getTargetContext().getContentResolver()); int size = outputGalleryFile.available(); byte[] directFileContents = new byte[size]; diff --git a/runner/android_junit_runner/javatests/androidx/test/internal/runner/RunnerArgsTest.java b/runner/android_junit_runner/javatests/androidx/test/internal/runner/RunnerArgsTest.java index f6c711be8..f0a2c87d4 100644 --- a/runner/android_junit_runner/javatests/androidx/test/internal/runner/RunnerArgsTest.java +++ b/runner/android_junit_runner/javatests/androidx/test/internal/runner/RunnerArgsTest.java @@ -759,12 +759,12 @@ public OutputStream openInternalOutputFile(String pathname) { } @Override - public Uri getInputFileUri2(String pathname) { + public Uri getInputFileUri(String pathname) { throw new UnsupportedOperationException(); } @Override - public Uri getOutputFileUri2(String pathname) { + public Uri getOutputFileUri(String pathname) { throw new UnsupportedOperationException(); } diff --git a/runner/monitor/java/androidx/test/platform/io/FileTestStorage.java b/runner/monitor/java/androidx/test/platform/io/FileTestStorage.java index 92ebb7acb..ec7dc7df7 100644 --- a/runner/monitor/java/androidx/test/platform/io/FileTestStorage.java +++ b/runner/monitor/java/androidx/test/platform/io/FileTestStorage.java @@ -152,12 +152,12 @@ public OutputStream openInternalOutputFile(String pathname) throws FileNotFoundE } @Override - public Uri getInputFileUri2(@NonNull String pathname) { + public Uri getInputFileUri(@NonNull String pathname) { throw new UnsupportedOperationException(); } @Override - public Uri getOutputFileUri2(@NonNull String pathname) { + public Uri getOutputFileUri(@NonNull String pathname) { File outputFile = new File(pathname); if (!outputFile.isAbsolute()) { outputFile = new File(outputDirCalculator.getOutputDir(), pathname); diff --git a/runner/monitor/java/androidx/test/platform/io/PlatformTestStorage.java b/runner/monitor/java/androidx/test/platform/io/PlatformTestStorage.java index 66ff8dc2d..a33cf1f9e 100644 --- a/runner/monitor/java/androidx/test/platform/io/PlatformTestStorage.java +++ b/runner/monitor/java/androidx/test/platform/io/PlatformTestStorage.java @@ -129,7 +129,15 @@ public interface PlatformTestStorage { * @return a content Uri to the test file dependency. *
Note: temporary API - will be renamed to getInputFileUri in future */ - Uri getInputFileUri2(@NonNull String pathname); + Uri getInputFileUri(@NonNull String pathname); + + /** + * @deprecated use getInputFileUri instead + */ + @Deprecated + default Uri getInputFileUri2(@NonNull String pathname) { + return getInputFileUri(pathname); + } /** * Provides a Uri to a test output file. @@ -146,7 +154,15 @@ public interface PlatformTestStorage { * "/path/to/my_output.txt", the file will end up at * "/sdcard/test_output_files/path/to/my_output.txt" on device. */ - Uri getOutputFileUri2(@NonNull String pathname); + Uri getOutputFileUri(@NonNull String pathname); + + /** + * @deprecated use getOutputFileUri instead + */ + @Deprecated + default Uri getOutputFileUri2(@NonNull String pathname) { + return getOutputFileUri(pathname); + } /** * Returns true if {@code pathname} corresponds to a file or directory that is in a directory diff --git a/runner/monitor/java/androidx/test/platform/io/PlatformTestStorageRegistry.java b/runner/monitor/java/androidx/test/platform/io/PlatformTestStorageRegistry.java index 14e21f790..73d380116 100644 --- a/runner/monitor/java/androidx/test/platform/io/PlatformTestStorageRegistry.java +++ b/runner/monitor/java/androidx/test/platform/io/PlatformTestStorageRegistry.java @@ -118,12 +118,12 @@ public OutputStream openInternalOutputFile(String pathname) { } @Override - public Uri getInputFileUri2(@NonNull String pathname) { + public Uri getInputFileUri(@NonNull String pathname) { return null; } @Override - public Uri getOutputFileUri2(@NonNull String pathname) { + public Uri getOutputFileUri(@NonNull String pathname) { return null; } diff --git a/services/storage/java/androidx/test/services/storage/TestStorage.java b/services/storage/java/androidx/test/services/storage/TestStorage.java index 013af7b7b..67d214132 100644 --- a/services/storage/java/androidx/test/services/storage/TestStorage.java +++ b/services/storage/java/androidx/test/services/storage/TestStorage.java @@ -76,15 +76,6 @@ public TestStorage(@NonNull ContentResolver contentResolver) { this.contentResolver = contentResolver; } - /** - * @deprecated call getInputFileUri2 instead - */ - @Deprecated - public static Uri getInputFileUri(@NonNull String pathname) { - checkNotNull(pathname); - return HostedFile.buildUri(HostedFile.FileHost.TEST_FILE, pathname); - } - /** * Provides a Uri to a test file dependency. * @@ -100,7 +91,7 @@ public static Uri getInputFileUri(@NonNull String pathname) { * @return a content Uri to the test file dependency. */ @Override - public Uri getInputFileUri2(@NonNull String pathname) { + public Uri getInputFileUri(@NonNull String pathname) { checkNotNull(pathname); return HostedFile.buildUri(HostedFile.FileHost.TEST_FILE, pathname); } @@ -119,16 +110,7 @@ public Uri getInputFileUri2(@NonNull String pathname) { * "/sdcard/test_output_files/path/to/my_output.txt" on device. */ @Override - public Uri getOutputFileUri2(@NonNull String pathname) { - checkNotNull(pathname); - return HostedFile.buildUri(HostedFile.FileHost.OUTPUT, pathname); - } - - /** - * @deprecated call getOutputFileUri2 instead - */ - @Deprecated - public static Uri getOutputFileUri(@NonNull String pathname) { + public Uri getOutputFileUri(@NonNull String pathname) { checkNotNull(pathname); return HostedFile.buildUri(HostedFile.FileHost.OUTPUT, pathname); } diff --git a/services/storage/javatests/androidx/test/services/storage/BUILD b/services/storage/javatests/androidx/test/services/storage/BUILD index e62d4b1dc..8529310a9 100644 --- a/services/storage/javatests/androidx/test/services/storage/BUILD +++ b/services/storage/javatests/androidx/test/services/storage/BUILD @@ -18,6 +18,7 @@ axt_android_library_test( ], deps = [ "//core/java/androidx/test/core", + "//runner/monitor/java/androidx/test:monitor", "//services/storage/java/androidx/test/services/storage", "//services/storage/java/androidx/test/services/storage/file", "@maven//:com_google_truth_truth", diff --git a/services/storage/javatests/androidx/test/services/storage/TestStorageTest.java b/services/storage/javatests/androidx/test/services/storage/TestStorageTest.java index 4a80621cb..c0e38e09a 100644 --- a/services/storage/javatests/androidx/test/services/storage/TestStorageTest.java +++ b/services/storage/javatests/androidx/test/services/storage/TestStorageTest.java @@ -120,7 +120,7 @@ public void readWriteOverwriteReadFile() throws IOException { } StringBuilder contents = new StringBuilder(); - Uri outputFileUri = testStorage.getOutputFileUri2("path/to/file"); + Uri outputFileUri = testStorage.getOutputFileUri("path/to/file"); try (InputStream input = TestStorageUtil.getInputStream( outputFileUri, getApplicationContext().getContentResolver())) { @@ -145,7 +145,7 @@ public void writeFileInAppendMode() throws IOException { } byte[] data = new byte[11]; - Uri outputFileUri = testStorage.getOutputFileUri2("path/to/file"); + Uri outputFileUri = testStorage.getOutputFileUri("path/to/file"); try (InputStream input = TestStorageUtil.getInputStream( outputFileUri, getApplicationContext().getContentResolver())) {