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