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

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

Issue 1879013002: 🍈 Unify application context usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove @CalledByNative Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 9
10 import org.chromium.android_webview.AwBrowserProcess; 10 import org.chromium.android_webview.AwBrowserProcess;
11 import org.chromium.android_webview.AwContents; 11 import org.chromium.android_webview.AwContents;
12 import org.chromium.android_webview.AwContentsStatics; 12 import org.chromium.android_webview.AwContentsStatics;
13 import org.chromium.base.ContextUtils;
13 import org.chromium.base.PathUtils; 14 import org.chromium.base.PathUtils;
14 import org.chromium.base.test.util.Feature; 15 import org.chromium.base.test.util.Feature;
15 import org.chromium.net.test.util.TestWebServer; 16 import org.chromium.net.test.util.TestWebServer;
16 17
17 import java.io.File; 18 import java.io.File;
18 19
19 /** 20 /**
20 * Test suite for the HTTP cache. 21 * Test suite for the HTTP cache.
21 */ 22 */
22 public class HttpCacheTest extends AwTestBase { 23 public class HttpCacheTest extends AwTestBase {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 File webViewLegacyCacheDir = new File( 76 File webViewLegacyCacheDir = new File(
76 PathUtils.getDataDirectory(targetContext), "Cache"); 77 PathUtils.getDataDirectory(targetContext), "Cache");
77 if (!webViewLegacyCacheDir.isDirectory()) { 78 if (!webViewLegacyCacheDir.isDirectory()) {
78 assertTrue(webViewLegacyCacheDir.mkdir()); 79 assertTrue(webViewLegacyCacheDir.mkdir());
79 assertTrue(webViewLegacyCacheDir.isDirectory()); 80 assertTrue(webViewLegacyCacheDir.isDirectory());
80 } 81 }
81 File dummyCacheFile = File.createTempFile("test", null, webViewLegacyCac heDir); 82 File dummyCacheFile = File.createTempFile("test", null, webViewLegacyCac heDir);
82 assertTrue(dummyCacheFile.exists()); 83 assertTrue(dummyCacheFile.exists());
83 84
84 // Set up JNI bindings. 85 // Set up JNI bindings.
86 ContextUtils.initApplicationContext(targetContext.getApplicationContext( ));
85 AwBrowserProcess.loadLibrary(targetContext); 87 AwBrowserProcess.loadLibrary(targetContext);
86 // No delay before removing the legacy cache files. 88 // No delay before removing the legacy cache files.
87 AwContentsStatics.setLegacyCacheRemovalDelayForTest(0); 89 AwContentsStatics.setLegacyCacheRemovalDelayForTest(0);
88 90
89 startBrowserProcess(); 91 startBrowserProcess();
90 final TestAwContentsClient contentClient = new TestAwContentsClient(); 92 final TestAwContentsClient contentClient = new TestAwContentsClient();
91 final AwTestContainerView testContainerView = 93 final AwTestContainerView testContainerView =
92 createAwTestContainerViewOnMainSync(contentClient); 94 createAwTestContainerViewOnMainSync(contentClient);
93 final AwContents awContents = testContainerView.getAwContents(); 95 final AwContents awContents = testContainerView.getAwContents();
94 96
(...skipping 10 matching lines...) Expand all
105 } finally { 107 } finally {
106 if (httpServer != null) { 108 if (httpServer != null) {
107 httpServer.shutdown(); 109 httpServer.shutdown();
108 } 110 }
109 } 111 }
110 112
111 assertFalse(webViewLegacyCacheDir.exists()); 113 assertFalse(webViewLegacyCacheDir.exists());
112 assertFalse(dummyCacheFile.exists()); 114 assertFalse(dummyCacheFile.exists());
113 } 115 }
114 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698