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

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

Issue 2076623002: 🍳 Fix and clean up application context in webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wrap context. Created 4 years, 6 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
Index: android_webview/javatests/src/org/chromium/android_webview/test/HttpCacheTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/HttpCacheTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/HttpCacheTest.java
index 55083d067d63040164ffc63c99089a63bf26997b..3c9e234ebee313cdd2b89e50a722abca5281630a 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/HttpCacheTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/HttpCacheTest.java
@@ -70,11 +70,10 @@ public class HttpCacheTest extends AwTestBase {
@SmallTest
@Feature({"AndroidWebView"})
public void testLegacyHttpCacheDirIsRemovedOnStartup() throws Exception {
- Context targetContext = getInstrumentation().getTargetContext();
+ Context appContext = getInstrumentation().getTargetContext().getApplicationContext();
PathUtils.setPrivateDataDirectorySuffix(
- AwBrowserProcess.PRIVATE_DATA_DIRECTORY_SUFFIX, targetContext);
- File webViewLegacyCacheDir = new File(
- PathUtils.getDataDirectory(targetContext), "Cache");
+ AwBrowserProcess.PRIVATE_DATA_DIRECTORY_SUFFIX, appContext);
+ File webViewLegacyCacheDir = new File(PathUtils.getDataDirectory(appContext), "Cache");
if (!webViewLegacyCacheDir.isDirectory()) {
assertTrue(webViewLegacyCacheDir.mkdir());
assertTrue(webViewLegacyCacheDir.isDirectory());
@@ -83,8 +82,8 @@ public class HttpCacheTest extends AwTestBase {
assertTrue(dummyCacheFile.exists());
// Set up JNI bindings.
- ContextUtils.initApplicationContext(targetContext.getApplicationContext());
- AwBrowserProcess.loadLibrary(targetContext);
+ ContextUtils.initApplicationContext(appContext);
+ AwBrowserProcess.loadLibrary();
// No delay before removing the legacy cache files.
AwContentsStatics.setLegacyCacheRemovalDelayForTest(0);

Powered by Google App Engine
This is Rietveld 408576698