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

Side by Side Diff: components/cronet/android/test/javatests/src/org/chromium/net/CronetTestBase.java

Issue 2412623002: Reland "Move PathUtils to use ContextUtils." (Closed)
Patch Set: Created 4 years, 2 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.net; 5 package org.chromium.net;
6 6
7 import android.test.AndroidTestCase; 7 import android.test.AndroidTestCase;
8 8
9 import org.chromium.base.ContextUtils;
9 import org.chromium.base.PathUtils; 10 import org.chromium.base.PathUtils;
10 11
11 import java.lang.annotation.ElementType; 12 import java.lang.annotation.ElementType;
12 import java.lang.annotation.Retention; 13 import java.lang.annotation.Retention;
13 import java.lang.annotation.RetentionPolicy; 14 import java.lang.annotation.RetentionPolicy;
14 import java.lang.annotation.Target; 15 import java.lang.annotation.Target;
15 import java.lang.reflect.AnnotatedElement; 16 import java.lang.reflect.AnnotatedElement;
16 import java.net.URL; 17 import java.net.URL;
17 18
18 /** 19 /**
19 * Base test class for all CronetTest based tests. 20 * Base test class for all CronetTest based tests.
20 */ 21 */
21 public class CronetTestBase extends AndroidTestCase { 22 public class CronetTestBase extends AndroidTestCase {
22 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "cronet_test"; 23 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "cronet_test";
23 private static final String LOOPBACK_ADDRESS = "127.0.0.1"; 24 private static final String LOOPBACK_ADDRESS = "127.0.0.1";
24 25
25 private CronetTestFramework mCronetTestFramework; 26 private CronetTestFramework mCronetTestFramework;
26 // {@code true} when test is being run against system HttpURLConnection impl ementation. 27 // {@code true} when test is being run against system HttpURLConnection impl ementation.
27 private boolean mTestingSystemHttpURLConnection; 28 private boolean mTestingSystemHttpURLConnection;
28 private boolean mTestingJavaImpl = false; 29 private boolean mTestingJavaImpl = false;
29 30
30 @Override 31 @Override
31 protected void setUp() throws Exception { 32 protected void setUp() throws Exception {
32 super.setUp(); 33 super.setUp();
33 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, g etContext()); 34 ContextUtils.initApplicationContext(getContext().getApplicationContext() );
35 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
34 CronetTestFramework.prepareTestStorage(getContext()); 36 CronetTestFramework.prepareTestStorage(getContext());
35 } 37 }
36 38
37 /** 39 /**
38 * Starts the CronetTest framework. 40 * Starts the CronetTest framework.
39 */ 41 */
40 protected CronetTestFramework startCronetTestFramework() { 42 protected CronetTestFramework startCronetTestFramework() {
41 return startCronetTestFrameworkWithUrlAndCronetEngineBuilder(null, null) ; 43 return startCronetTestFrameworkWithUrlAndCronetEngineBuilder(null, null) ;
42 } 44 }
43 45
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 @Target(ElementType.METHOD) 165 @Target(ElementType.METHOD)
164 @Retention(RetentionPolicy.RUNTIME) 166 @Retention(RetentionPolicy.RUNTIME)
165 public @interface OnlyRunCronetHttpURLConnection { 167 public @interface OnlyRunCronetHttpURLConnection {
166 } 168 }
167 169
168 @Target(ElementType.METHOD) 170 @Target(ElementType.METHOD)
169 @Retention(RetentionPolicy.RUNTIME) 171 @Retention(RetentionPolicy.RUNTIME)
170 public @interface OnlyRunNativeCronet {} 172 public @interface OnlyRunNativeCronet {}
171 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698