Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e092c89 authored by William Escande's avatar William Escande Committed by Automerger Merge Worker
Browse files

Merge changes Idf44cf41,I209b5ff3,I2605b245 into main am: dfd30241 am: eb7bc42e

parents 70ab058f eb7bc42e
Loading
Loading
Loading
Loading
+0 −44
Original line number Original line Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.bluetooth.channelsoundingtestapp;

import static com.google.common.truth.Truth.assertThat;

import android.content.Context;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {

    @Test
    public void useAppContext() {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
        assertThat(appContext.getPackageName())
                .isEqualto("com.android.bluetooth.channelsoundingtestapp");
    }
}
+0 −34
Original line number Original line Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.bluetooth.channelsoundingtestapp;

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {

    @Test
    public void addition_isCorrect() {
        assertThat(2 + 2).isEqualTo(4);
    }
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -87,7 +87,7 @@ public class BipImageDescriptor {
         * @param encoding The encoding you would like to set as a BIP spec defined string
         * @param encoding The encoding you would like to set as a BIP spec defined string
         * @return This object so you can continue building
         * @return This object so you can continue building
         */
         */
        public Builder setPropietaryEncoding(String encoding) {
        public Builder setProprietaryEncoding(String encoding) {
            mImageDescriptor.mEncoding = new BipEncoding(BipEncoding.USR_XXX, encoding);
            mImageDescriptor.mEncoding = new BipEncoding(BipEncoding.USR_XXX, encoding);
            return this;
            return this;
        }
        }
+8 −6
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package com.android.bluetooth.a2dp;
package com.android.bluetooth.a2dp;


import static com.google.common.truth.Truth.assertThat;

import static org.mockito.Mockito.*;
import static org.mockito.Mockito.*;


import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter;
@@ -243,22 +245,22 @@ public class A2dpCodecConfigTest {
        for (BluetoothCodecConfig config : codecConfigs) {
        for (BluetoothCodecConfig config : codecConfigs) {
            switch (config.getCodecType()) {
            switch (config.getCodecType()) {
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
                    Assert.assertEquals(config.getCodecPriority(), SBC_PRIORITY_DEFAULT);
                    assertThat(config.getCodecPriority()).isEqualTo(SBC_PRIORITY_DEFAULT);
                    break;
                    break;
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
                    Assert.assertEquals(config.getCodecPriority(), AAC_PRIORITY_DEFAULT);
                    assertThat(config.getCodecPriority()).isEqualTo(AAC_PRIORITY_DEFAULT);
                    break;
                    break;
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
                    Assert.assertEquals(config.getCodecPriority(), APTX_PRIORITY_DEFAULT);
                    assertThat(config.getCodecPriority()).isEqualTo(APTX_PRIORITY_DEFAULT);
                    break;
                    break;
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
                    Assert.assertEquals(config.getCodecPriority(), APTX_HD_PRIORITY_DEFAULT);
                    assertThat(config.getCodecPriority()).isEqualTo(APTX_HD_PRIORITY_DEFAULT);
                    break;
                    break;
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
                    Assert.assertEquals(config.getCodecPriority(), LDAC_PRIORITY_DEFAULT);
                    assertThat(config.getCodecPriority()).isEqualTo(LDAC_PRIORITY_DEFAULT);
                    break;
                    break;
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS:
                case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS:
                    Assert.assertEquals(config.getCodecPriority(), OPUS_PRIORITY_DEFAULT);
                    assertThat(config.getCodecPriority()).isEqualTo(OPUS_PRIORITY_DEFAULT);
                    break;
                    break;
            }
            }
        }
        }
+11 −12
Original line number Original line Diff line number Diff line
@@ -44,7 +44,6 @@ import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.TestUtils;


import org.junit.After;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.Test;
@@ -274,7 +273,7 @@ public class BrowserPlayerWrapperTest {
        MediaBrowser.ConnectionCallback browserConnCb = mBrowserConnCb.getValue();
        MediaBrowser.ConnectionCallback browserConnCb = mBrowserConnCb.getValue();
        browserConnCb.onConnected();
        browserConnCb.onConnected();


        Assert.assertEquals("root_folder", wrapper.getRootId());
        assertThat(wrapper.getRootId()).isEqualTo("root_folder");
        verify(mMockBrowser).disconnect();
        verify(mMockBrowser).disconnect();
    }
    }


@@ -392,22 +391,22 @@ public class BrowserPlayerWrapperTest {
        for (int i = 0; i < item_list.size(); i++) {
        for (int i = 0; i < item_list.size(); i++) {
            MediaItem expected = items.get(i);
            MediaItem expected = items.get(i);
            ListItem item = item_list.get(i);
            ListItem item = item_list.get(i);
            Assert.assertEquals(expected.isBrowsable(), item.isFolder);
            assertThat(item.isFolder).isEqualTo(expected.isBrowsable());
            if (item.isFolder) {
            if (item.isFolder) {
                Folder folder = item.folder;
                Folder folder = item.folder;
                assertThat(folder).isNotNull();
                assertThat(folder).isNotNull();
                assertThat(folder.isPlayable).isFalse();
                assertThat(folder.isPlayable).isFalse();
                Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId);
                assertThat(folder.mediaId).isEqualTo(expected.getDescription().getMediaId());
                Assert.assertEquals(expected.getDescription().getTitle().toString(), folder.title);
                assertThat(folder.title).isEqualTo(expected.getDescription().getTitle().toString());
            } else {
            } else {
                Metadata song = item.song;
                Metadata song = item.song;
                assertThat(song).isNotNull();
                assertThat(song).isNotNull();
                Assert.assertEquals(expected.getDescription().getMediaId(), song.mediaId);
                assertThat(song.mediaId).isEqualTo(expected.getDescription().getMediaId());
                Assert.assertEquals(expected.getDescription().getTitle().toString(), song.title);
                assertThat(song.title).isEqualTo(expected.getDescription().getTitle().toString());
                Assert.assertEquals(
                assertThat(song.artist)
                        expected.getDescription().getSubtitle().toString(), song.artist);
                        .isEqualTo(expected.getDescription().getSubtitle().toString());
                Assert.assertEquals(
                assertThat(song.album)
                        expected.getDescription().getDescription().toString(), song.album);
                        .isEqualTo(expected.getDescription().getDescription().toString());
                if (expected.getDescription().getIconBitmap() != null) {
                if (expected.getDescription().getIconBitmap() != null) {
                    assertThat(song.image).isNotNull();
                    assertThat(song.image).isNotNull();
                    Bitmap expectedBitmap = expected.getDescription().getIconBitmap();
                    Bitmap expectedBitmap = expected.getDescription().getIconBitmap();
@@ -415,7 +414,7 @@ public class BrowserPlayerWrapperTest {
                } else if (expected.getDescription().getIconUri() != null) {
                } else if (expected.getDescription().getIconUri() != null) {
                    assertThat(mTestBitmap.sameAs(song.image.getImage())).isTrue();
                    assertThat(mTestBitmap.sameAs(song.image.getImage())).isTrue();
                } else {
                } else {
                    Assert.assertEquals(null, song.image);
                    assertThat(song.image).isNull();
                }
                }
            }
            }
        }
        }
Loading