@@ -0,0 +1,2467 @@
+/*%0A * Copyright 2021 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.google.android.exoplayer2.testutil;%0A%0Aimport android.net.Uri;%0Aimport androidx.test.ext.junit.runners.AndroidJUnit4;%0Aimport com.google.android.exoplayer2.upstream.DataSource;%0Aimport com.google.common.collect.ImmutableList;%0Aimport org.junit.Before;%0Aimport org.junit.runner.RunWith;%0A%0A/** %7B@link DataSource%7D contract tests for %7B@link FakeDataSource%7D. */%0A@RunWith(AndroidJUnit4.class)%0Apublic class FakeDataSourceContractTest extends DataSourceContractTest %7B%0A%0A  private Uri simpleUri;%0A  private Uri unknownLengthUri;%0A%0A  private byte%5B%5D simpleData;%0A  private byte%5B%5D unknownLengthData;%0A  private FakeDataSet fakeDataSet;%0A%0A  @Before%0A  public void setUp() %7B%0A    simpleUri = Uri.parse(%22test://simple.test%22);%0A    unknownLengthUri = Uri.parse(%22test://unknown-length.test%22);%0A    simpleData = TestUtil.buildTestData(/* length= */ 20);%0A    unknownLengthData = TestUtil.buildTestData(/* length= */ 40);%0A    fakeDataSet =%0A        new FakeDataSet()%0A            .newData(simpleUri)%0A            .appendReadData(simpleData)%0A            .endData()%0A            .newData(unknownLengthUri)%0A            .setSimulateUnknownLength(true)%0A            .appendReadData(unknownLengthData)%0A            .endData();%0A  %7D%0A%0A  @Override%0A  protected ImmutableList%3CTestResource%3E getTestResources() %7B%0A    return ImmutableList.of(%0A        new TestResource.Builder()%0A            .setName(%22simple%22)%0A            .setUri(simpleUri)%0A            .setExpectedBytes(simpleData)%0A            .build(),%0A        new TestResource.Builder()%0A            .setName(%22unknown length%22)%0A            .setUri(unknownLengthUri)%0A            .setExpectedBytes(unknownLengthData)%0A            .build());%0A  %7D%0A%0A  @Override%0A  protected Uri getNotFoundUri() %7B%0A    return Uri.parse(%22test://not-found.test%22);%0A  %7D%0A%0A  @Override%0A  protected DataSource createDataSource() %7B%0A    return new FakeDataSource(fakeDataSet);%0A  %7D%0A%7D%0A

Add FakeDataSourceContractTest