Commit deaf4180 authored by Rohit Agarwal's avatar Rohit Agarwal Committed by Commit Bot

Modify incognito notification related test to run from Android M.

Incognito notification tests were using @TargetApi annotation to ensure
not running the tests in older android versions but the @TargetApi
annotation has no effect in runtime and only has Class level retention
which is useful for lint checks only.

This CL uses @MinAndroidSdkLevel annotation instead.

Bug: 1134241
Change-Id: I25788cb1492d1d719a667b0da1683e52a5caf1ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2448371Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Commit-Queue: Rohit Agarwal <roagarwal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813768}
parent dc4fb61c
...@@ -11,7 +11,6 @@ import static org.junit.Assert.assertTrue; ...@@ -11,7 +11,6 @@ import static org.junit.Assert.assertTrue;
import static org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.addActionButtonToIntent; import static org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.addActionButtonToIntent;
import static org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.createTestBitmap; import static org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.createTestBitmap;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
...@@ -43,6 +42,7 @@ import org.junit.runner.RunWith; ...@@ -43,6 +42,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.OnFinishedForTest; import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.OnFinishedForTest;
import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar;
...@@ -197,7 +197,7 @@ public class CustomTabActivityIncognitoTest { ...@@ -197,7 +197,7 @@ public class CustomTabActivityIncognitoTest {
@MediumTest @MediumTest
@Features.EnableFeatures({ChromeFeatureList.CCT_INCOGNITO}) @Features.EnableFeatures({ChromeFeatureList.CCT_INCOGNITO})
@TargetApi(Build.VERSION_CODES.M) @TargetApi(Build.VERSION_CODES.M)
@SuppressLint("NewApi") @MinAndroidSdkLevel(Build.VERSION_CODES.M)
public void closeAllIncognitoNotificationIsNotDisplayed() throws Exception { public void closeAllIncognitoNotificationIsNotDisplayed() throws Exception {
// It may happen that some previous incognito notification from tabbed activity may be // It may happen that some previous incognito notification from tabbed activity may be
// already be lying around. So, we test the delta instead to be 0. // already be lying around. So, we test the delta instead to be 0.
......
file://chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS file://chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS
per-file *CustomTabActivityIncognitoTest*=roagarwal@chromium.org
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.incognito; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.incognito;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
...@@ -29,6 +28,7 @@ import org.chromium.base.library_loader.LibraryLoader; ...@@ -29,6 +28,7 @@ import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
...@@ -190,7 +190,7 @@ public class IncognitoNotificationServiceTest { ...@@ -190,7 +190,7 @@ public class IncognitoNotificationServiceTest {
@MediumTest @MediumTest
@Feature("Incognito") @Feature("Incognito")
@TargetApi(Build.VERSION_CODES.M) @TargetApi(Build.VERSION_CODES.M)
@SuppressLint("NewApi") @MinAndroidSdkLevel(Build.VERSION_CODES.M)
public void testCloseAllIncognitoNotificationIsDisplayed() { public void testCloseAllIncognitoNotificationIsDisplayed() {
mActivityTestRule.startMainActivityOnBlankPage(); mActivityTestRule.startMainActivityOnBlankPage();
......
per-file *Leakage*=roagarwal@chromium.org
per-file *IncognitoDataTestUtils*=roagarwal@chromium.org
# TEAM: chrome-privacy-core@google.com
# COMPONENT: Privacy>Incognito
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment