Delete test moved to CTS
The class was marked as @TestApi, so move all of the tests to CTS Test: make Bug: 141335957 Change-Id: I6613cda72d14477f99e2f4f3da6c27034c09886d
This commit is contained in:
@@ -1,122 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 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.server.notification;
|
||||
|
||||
import static android.service.notification.NotificationStats.DISMISSAL_PEEK;
|
||||
import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEGATIVE;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.service.notification.NotificationStats;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.UiServiceTestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class NotificationStatsTest extends UiServiceTestCase {
|
||||
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
|
||||
assertFalse(stats.hasSeen());
|
||||
assertFalse(stats.hasDirectReplied());
|
||||
assertFalse(stats.hasExpanded());
|
||||
assertFalse(stats.hasInteracted());
|
||||
assertFalse(stats.hasViewedSettings());
|
||||
assertFalse(stats.hasSnoozed());
|
||||
assertEquals(NotificationStats.DISMISSAL_NOT_DISMISSED, stats.getDismissalSurface());
|
||||
assertEquals(NotificationStats.DISMISS_SENTIMENT_UNKNOWN, stats.getDismissalSentiment());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeen() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setSeen();
|
||||
assertTrue(stats.hasSeen());
|
||||
assertFalse(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectReplied() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setDirectReplied();
|
||||
assertTrue(stats.hasDirectReplied());
|
||||
assertTrue(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpanded() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setExpanded();
|
||||
assertTrue(stats.hasExpanded());
|
||||
assertTrue(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSnoozed() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setSnoozed();
|
||||
assertTrue(stats.hasSnoozed());
|
||||
assertTrue(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testViewedSettings() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setViewedSettings();
|
||||
assertTrue(stats.hasViewedSettings());
|
||||
assertTrue(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDismissalSurface() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setDismissalSurface(DISMISSAL_PEEK);
|
||||
assertEquals(DISMISSAL_PEEK, stats.getDismissalSurface());
|
||||
assertFalse(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDismissalSentiment() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setDismissalSentiment(DISMISS_SENTIMENT_NEGATIVE);
|
||||
assertEquals(DISMISS_SENTIMENT_NEGATIVE, stats.getDismissalSentiment());
|
||||
assertFalse(stats.hasInteracted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteToParcel() {
|
||||
NotificationStats stats = new NotificationStats();
|
||||
stats.setViewedSettings();
|
||||
stats.setDismissalSurface(NotificationStats.DISMISSAL_AOD);
|
||||
stats.setDismissalSentiment(NotificationStats.DISMISS_SENTIMENT_POSITIVE);
|
||||
Parcel parcel = Parcel.obtain();
|
||||
stats.writeToParcel(parcel, 0);
|
||||
parcel.setDataPosition(0);
|
||||
NotificationStats stats1 = NotificationStats.CREATOR.createFromParcel(parcel);
|
||||
assertEquals(stats, stats1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user