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

Commit a09d1609 authored by James Lemieux's avatar James Lemieux Committed by Android (Google) Code Review
Browse files

Merge "Use tip-of-tree robolectric"

parents 81ba05f6 dda729cb
Loading
Loading
Loading
Loading
+25 −18
Original line number Diff line number Diff line
# Bluetooth Robolectric test target.

#############################################################
# Bluetooth Robolectric test target.                        #
#############################################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := BluetoothRoboTests

LOCAL_SRC_FILES := $(call all-java-files-under, src)

# Include the testing libraries (JUnit4 + Robolectric libs).
LOCAL_STATIC_JAVA_LIBRARIES := \
    truth-prebuilt \
    mockito-robolectric-prebuilt
LOCAL_RESOURCE_DIR := \
    $(LOCAL_PATH)/res

LOCAL_JAVA_RESOURCE_DIRS := config

# Include the testing libraries
LOCAL_JAVA_LIBRARIES := \
    junit \
    platform-robolectric-3.6.2-prebuilt
    robolectric_android-all-stub \
    Robolectric_all-target \
    mockito-robolectric-prebuilt \
    truth-prebuilt

LOCAL_INSTRUMENTATION_FOR := Bluetooth
LOCAL_MODULE := BluetoothRoboTests

LOCAL_MODULE_TAGS := optional

include $(BUILD_STATIC_JAVA_LIBRARY)


# Bluetooth runner target to run the previous target.

#############################################################
# Bluetooth runner target to run the previous target.       #
#############################################################
include $(CLEAR_VARS)

LOCAL_MODULE := RunBluetoothRoboTests

LOCAL_SDK_VERSION := current

LOCAL_STATIC_JAVA_LIBRARIES := \
    BluetoothRoboTests
LOCAL_JAVA_LIBRARIES := \
    BluetoothRoboTests \
    robolectric_android-all-stub \
    Robolectric_all-target \
    mockito-robolectric-prebuilt \
    truth-prebuilt

LOCAL_TEST_PACKAGE := Bluetooth

LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src

include prebuilts/misc/common/robolectric/3.6.2/run_robotests.mk
include external/robolectric-shadows/run_robotests.mk
+2 −0
Original line number Diff line number Diff line
manifest=packages/apps/Bluetooth/tests/robotests/AndroidManifest.xml
sdk=NEWEST_SDK
+0 −23
Original line number Diff line number Diff line
/*
 * Copyright 2017 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;

public class TestConfig {
    public static final int SDK_VERSION = 23;
    public static final String MANIFEST_PATH =
            "packages/apps/Bluetooth/tests/robotests/AndroidManifest.xml";
}
+6 −12
Original line number Diff line number Diff line
@@ -26,30 +26,26 @@ import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;

import com.android.bluetooth.TestConfig;

import java.io.FileInputStream;
import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.io.FileInputStream;
import java.io.IOException;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class OppSendFileInfoTest {

    // Constants for test file size.
    private static final int TEST_FILE_SIZE = 10;
    private static final int MAXIMUM_FILE_SIZE = 0xFFFFFFFF;

    @Mock Context mContext;
    @Mock ContentResolver mContentResolver;
    @Mock FileInputStream mFileInputStream;
    @Mock private Context mContext;
    @Mock private ContentResolver mContentResolver;
    @Mock private FileInputStream mFileInputStream;

    @Before
    public void setUp() {
@@ -104,7 +100,5 @@ public class OppSendFileInfoTest {
        BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(
                mContext, uri, "text/plain", false);
        assertThat(sendFileInfo).isEqualTo(BluetoothOppSendFileInfo.SEND_FILE_INFO_ERROR);

    }

}