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