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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java

Issue 292183007: Keep the reference of passing request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix findbug Created 6 years, 7 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: android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java
index b4a132bca6e68b3a9a6d528a961562db6f94ce21..5fc6770c069c6439302830c9790befbd524ec86d 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java
@@ -32,7 +32,7 @@ public class MediaAccessPermissionRequestTest extends AwTestBase {
}
}
- private final String mData = "<html> <script> " +
+ private static final String mData = "<html> <script> " +
"var constraints = {audio: true, video: true};" +
"var video = document.querySelector('video');" +
"function successCallback(stream) {" +
@@ -130,15 +130,20 @@ public class MediaAccessPermissionRequestTest extends AwTestBase {
final OnPermissionRequestHelper helper = new OnPermissionRequestHelper();
TestAwContentsClient contentsClient =
new TestAwContentsClient() {
+ private AwPermissionRequest mRequest;
@Override
public void onPermissionRequest(AwPermissionRequest awPermissionRequest) {
+ assertNull(mRequest);
+ mRequest = awPermissionRequest;
// Don't respond and wait for the request canceled.
helper.notifyCalled();
}
@Override
public void onPermissionRequestCanceled(
AwPermissionRequest awPermissionRequest) {
- helper.notifyCanceled();
+ assertNotNull(mRequest);
+ if (mRequest == awPermissionRequest) helper.notifyCanceled();
+ mRequest = null;
}
};
final AwTestContainerView testContainerView =
@@ -152,6 +157,6 @@ public class MediaAccessPermissionRequestTest extends AwTestBase {
// Load the same page again, the previous request should be canceled.
loadUrlAsync(awContents, mWebRTCPage, null);
helper.waitForCallback(callCount);
- assert (helper.canceled());
+ assertTrue(helper.canceled());
}
}
« 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