1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.android.libraries.mobiledatadownload.file.backends; 17 18 import android.net.Uri; 19 import com.google.android.libraries.mobiledatadownload.file.common.testing.BackendTestBase; 20 import com.google.android.libraries.mobiledatadownload.file.spi.Backend; 21 import com.google.common.collect.ImmutableList; 22 import com.google.thirdparty.robolectric.GoogleRobolectricTestRunner; 23 import java.util.List; 24 import org.junit.runner.RunWith; 25 26 @RunWith(GoogleRobolectricTestRunner.class) 27 public final class MemoryBackendTest extends BackendTestBase { 28 29 private final Backend backend = new MemoryBackend(); 30 31 @Override backend()32 protected Backend backend() { 33 return backend; 34 } 35 36 @Override legalUriBase()37 protected Uri legalUriBase() { 38 return Uri.parse("memory:"); 39 } 40 41 @Override illegalUrisToRead()42 protected List<Uri> illegalUrisToRead() { 43 return ImmutableList.of( 44 Uri.parse("memory:"), 45 Uri.parse("memory://<internal>@authority:123/uriWithAuthority"), 46 Uri.parse("memory:///uriWithQuery?q=a")); 47 } 48 49 @Override illegalUrisToWrite()50 protected List<Uri> illegalUrisToWrite() { 51 return illegalUrisToRead(); 52 } 53 54 @Override supportsAppend()55 protected boolean supportsAppend() { 56 return false; 57 } 58 59 @Override supportsDirectories()60 protected boolean supportsDirectories() { 61 return false; 62 } 63 64 @Override supportsFileConvertible()65 protected boolean supportsFileConvertible() { 66 return false; 67 } 68 69 @Override supportsToFile()70 protected boolean supportsToFile() { 71 return false; 72 } 73 } 74