1 /*
2  * Copyright (C) 2024 The Android Open Source Project
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 
17 package com.android.providers.media;
18 
19 import static com.google.common.truth.Truth.assertThat;
20 
21 import android.net.Uri;
22 
23 import org.junit.Test;
24 
25 /**
26  * This class exists mostly for code coverage purposes
27  */
28 public class TranscodeHelperNoOpTest {
29 
30     private static final String TEST_STRING = "foo";
31     private final TranscodeHelperNoOp mTranscodeHelper = new TranscodeHelperNoOp();
32 
33     @Test
testBasicFunctionality()34     public void testBasicFunctionality() {
35         mTranscodeHelper.freeCache(1L);
36         mTranscodeHelper.onAnrDelayStarted(TEST_STRING, 0, 0, 0);
37         assertThat(mTranscodeHelper.transcode(TEST_STRING, TEST_STRING, 0, 0)).isFalse();
38         assertThat(mTranscodeHelper.prepareIoPath(TEST_STRING, 0)).isNull();
39         assertThat(mTranscodeHelper.shouldTranscode(TEST_STRING, 0, null)).isEqualTo(0);
40         mTranscodeHelper.onUriPublished(Uri.EMPTY);
41         assertThat(mTranscodeHelper.supportsTranscode(TEST_STRING)).isFalse();
42         mTranscodeHelper.onUriPublished(Uri.EMPTY);
43         mTranscodeHelper.onFileOpen(TEST_STRING, TEST_STRING, 0, 0);
44         assertThat(mTranscodeHelper.isTranscodeFileCached(TEST_STRING, TEST_STRING)).isFalse();
45         assertThat(mTranscodeHelper.deleteCachedTranscodeFile(1L)).isFalse();
46         mTranscodeHelper.dump(null);
47         assertThat(mTranscodeHelper.getSupportedRelativePaths()).isEmpty();
48     }
49 }
50