Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Tests for the test storage.

load("//build_extensions:android_library_test.bzl", "axt_android_library_test")
load("//build_extensions:phone_devices.bzl", "devices")
load("//build_extensions:phone_devices.bzl", "apis", "devices")

package(
default_applicable_licenses = ["//services:license"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;

import android.content.Context;
import android.net.Uri;
import android.os.UserManager;
import androidx.test.services.storage.file.HostedFile;
import androidx.test.services.storage.internal.TestStorageUtil;
import java.io.BufferedReader;
Expand Down Expand Up @@ -113,19 +110,11 @@ public void addOutputProperties() throws Exception {

@Test
public void writeInternalFile() throws IOException {
// known not to work in multi-user mode
assumeTrue(isSystemUser());
try (OutputStream output = testStorage.openInternalOutputFile("path/to/file")) {
output.write(new byte[] {'h', 'e', 'l', 'l', 'o'});
}
}

private static boolean isSystemUser() {

UserManager um = ((UserManager) getApplicationContext().getSystemService(Context.USER_SERVICE));
return um.isSystemUser();
}

@Test
public void readWriteOverwriteReadFile() throws IOException {
try (OutputStream output = testStorage.openOutputFile("path/to/file")) {
Expand Down
Loading