Commit 887a7eb8 authored by ajith.v@samsung.com's avatar ajith.v@samsung.com

Fixed Compilation issues related to API Level of Android

Made changes based on new API level to make Lint happy in all
builds.

BUG=327768

Review URL: https://codereview.chromium.org/460453002

Cr-Commit-Position: refs/heads/master@{#289190}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289190 0039d316-1c4b-4281-b951-d872f2087c98
parent 2285f6bd
......@@ -4,9 +4,11 @@
package org.chromium.chrome.browser;
import android.annotation.TargetApi;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
......@@ -98,10 +100,15 @@ public class SmartClipProviderTest extends ChromeShellTestBase implements Handle
new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE });
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@Override
public void tearDown() throws Exception {
try {
mHandlerThread.quitSafely();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mHandlerThread.quitSafely();
} else {
mHandlerThread.quit();
}
} finally {
super.tearDown();
}
......
......@@ -4,8 +4,10 @@
package org.chromium.chrome.browser.input;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.provider.MediaStore;
import android.test.suitebuilder.annotation.MediumTest;
......@@ -88,6 +90,7 @@ public class SelectFileDialogTest extends ChromeShellTestBase {
/**
* Tests that clicks on <input type="file" /> trigger intent calls to ActivityWindowAndroid.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@MediumTest
@Feature({"TextInput", "Main"})
public void testSelectFileAndCancelRequest() throws Throwable {
......@@ -104,7 +107,9 @@ public class SelectFileDialogTest extends ChromeShellTestBase {
Intent contentIntent = (Intent)
mActivityWindowAndroidForTest.lastIntent.getParcelableExtra(Intent.EXTRA_INTENT);
assertNotNull(contentIntent);
assertTrue(contentIntent.hasExtra(Intent.EXTRA_ALLOW_MULTIPLE));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
assertTrue(contentIntent.hasExtra(Intent.EXTRA_ALLOW_MULTIPLE));
}
resetActivityWindowAndroidForTest();
DOMUtils.clickNode(this, mContentViewCore, "input_image");
......
......@@ -4,6 +4,8 @@
package org.chromium.printing;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.print.PageRange;
......@@ -72,6 +74,7 @@ public class PrintingControllerTest extends ChromeShellTestBase {
* controller: onStart, onLayout, onWrite, onFinish. Each one is called once, and in this
* order, in the UI thread.
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
@LargeTest
@Feature({"Printing"})
public void testNormalPrintingFlow() throws Throwable {
......@@ -197,6 +200,7 @@ public class PrintingControllerTest extends ChromeShellTestBase {
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void callLayoutOnUiThread(
final PrintingControllerImpl controller,
final PrintAttributes oldAttributes,
......@@ -219,6 +223,7 @@ public class PrintingControllerTest extends ChromeShellTestBase {
}
}
@TargetApi(Build.VERSION_CODES.KITKAT)
private void callWriteOnUiThread(
final PrintingControllerImpl controller,
final ParcelFileDescriptor descriptor,
......
......@@ -4,6 +4,7 @@
package org.chromium.content.browser;
import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
......@@ -47,6 +48,7 @@ public class ClipboardTest extends ContentShellTestBase {
* the HTML representation of the fragment to be available.
*/
@LargeTest
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Feature({"Clipboard","TextInput"})
@RerunWithUpdatedContainerView
public void testCopyDocumentFragment() throws Throwable {
......@@ -116,4 +118,4 @@ public class ClipboardTest extends ContentShellTestBase {
return false;
}
}
\ No newline at end of file
}
......@@ -4,7 +4,9 @@
package org.chromium.content_shell_apk;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.PowerManager;
import android.test.suitebuilder.annotation.Smoke;
......@@ -14,12 +16,18 @@ import org.chromium.base.test.util.Feature;
* Test that verifies preconditions for tests to run.
*/
public class ContentShellPreconditionsTest extends ContentShellTestBase {
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
@SuppressWarnings("deprecation")
@Smoke
@Feature({"TestInfrastructure"})
public void testScreenIsOn() throws Exception {
PowerManager pm = (PowerManager) getInstrumentation().getContext().getSystemService(
Context.POWER_SERVICE);
assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
assertTrue("Many tests will fail if the screen is not on.", pm.isInteractive());
} else {
assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn());
}
}
}
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