Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Issue 2380593002: Check whether it has the permission to read files when running ImeTest (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
index 7a53c32b96b6a0d19e243d5af318f8e660b71567..f10d7fd58ccd26521d6995e14f9f447376a3acde 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -4,13 +4,16 @@
package org.chromium.content.browser.input;
+import android.Manifest;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Handler;
import android.os.Looper;
+import android.os.Process;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.InputType;
@@ -22,6 +25,7 @@ import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisabledTest;
@@ -84,6 +88,7 @@ public class ImeTest extends ContentShellTestBase {
public void setUp() throws Exception {
super.setUp();
startActivityWithTestUrl(INPUT_FORM_HTML);
+ assertHaveFileReadPermission();
mContentViewCore = getContentViewCore();
mWebContents = getWebContents();
@@ -1556,6 +1561,21 @@ public class ImeTest extends ContentShellTestBase {
});
}
+ private void assertHaveFileReadPermission() throws InterruptedException {
+ CriteriaHelper.pollInstrumentationThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ int pid = Process.myPid();
+ int uid = Process.myUid();
+ boolean granted = ApiCompatibilityUtils.checkPermission(getActivity(),
+ Manifest.permission.READ_EXTERNAL_STORAGE, pid, uid)
+ == PackageManager.PERMISSION_GRANTED;
+ updateFailureReason("File read permission was granted: " + granted);
+ return granted;
+ }
+ });
+ }
+
private void assertWaitForKeyboardStatus(final boolean show) throws InterruptedException {
CriteriaHelper.pollUiThread(new Criteria() {
@Override
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698