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

Commit ff449699 authored by Sahin Caliskan's avatar Sahin Caliskan Committed by Gerrit Code Review
Browse files

Merge "Add RcsController tests"

parents 9bff1bd6 37f1aeac
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -19,10 +19,15 @@ package com.android.internal.telephony;
import android.content.Context;
import android.os.ServiceManager;
import android.telephony.Rlog;
import android.telephony.rcs.RcsManager;

/** Backing implementation of {@link android.telephony.RcsManager}. */
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.rcs.IRcs;

/** Backing implementation of {@link RcsManager}. */
public class RcsController extends IRcs.Stub {
    private static final String TAG = "RcsController";
    private static final String RCS_SERVICE_NAME = "ircs";

    private static RcsController sInstance;

@@ -42,11 +47,24 @@ public class RcsController extends IRcs.Stub {

    private RcsController(Context context) {
        mContext = context;
        ServiceManager.addService("ircs", this);
        if (ServiceManager.getService(RCS_SERVICE_NAME) == null) {
            ServiceManager.addService(RCS_SERVICE_NAME, this);
        }
    }

    @VisibleForTesting
    public RcsController(Context context, Void unused) {
        mContext = context;
    }

    @Override
    public void deleteThread(int threadId) {
        // TODO - add implementation
    }

    @Override
    public int getMessageCount(int rcsThreadId) {
        // TODO - add implementation. Return a magic number for now to test the RPC calls
        return 1018;
    }
}
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright 2018 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.internal.telephony.rcs;

import static org.junit.Assert.assertEquals;

import com.android.internal.telephony.RcsController;
import com.android.internal.telephony.TelephonyTest;

import org.junit.Before;
import org.junit.Test;

public class RcsControllerTest extends TelephonyTest {

    private RcsController mRcsController;

    @Before
    public void setUp() {
        mRcsController = new RcsController(mContext, null);
    }

    /**
     * TODO(sahinc): fix the test once there is an implementation in place
     */
    @Test
    public void testGetMessageCount() {
        assertEquals(1018, mRcsController.getMessageCount(0));
    }
}