| 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.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.net.Uri; | 9 import android.net.Uri; |
| 10 import android.test.ActivityInstrumentationTestCase2; | 10 import android.test.ActivityInstrumentationTestCase2; |
| 11 import android.text.TextUtils; | 11 import android.text.TextUtils; |
| 12 | 12 |
| 13 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 13 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
| 14 | 14 |
| 15 import org.chromium.base.PathUtils; | 15 import org.chromium.base.PathUtils; |
| 16 | 16 |
| 17 import org.chromium.net.urlconnection.CronetHttpURLConnectionTest; | |
| 18 | |
| 19 import java.io.File; | 17 import java.io.File; |
| 20 import java.lang.annotation.ElementType; | 18 import java.lang.annotation.ElementType; |
| 21 import java.lang.annotation.Retention; | 19 import java.lang.annotation.Retention; |
| 22 import java.lang.annotation.RetentionPolicy; | 20 import java.lang.annotation.RetentionPolicy; |
| 23 import java.lang.annotation.Target; | 21 import java.lang.annotation.Target; |
| 24 import java.lang.reflect.Method; | 22 import java.lang.reflect.Method; |
| 25 import java.net.URL; | 23 import java.net.URL; |
| 26 import java.util.concurrent.atomic.AtomicBoolean; | 24 import java.util.concurrent.atomic.AtomicBoolean; |
| 27 | 25 |
| 28 /** | 26 /** |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } catch (Throwable e) { | 136 } catch (Throwable e) { |
| 139 return false; | 137 return false; |
| 140 } | 138 } |
| 141 } | 139 } |
| 142 }, WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT, | 140 }, WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT, |
| 143 CriteriaHelper.DEFAULT_POLLING_INTERVAL); | 141 CriteriaHelper.DEFAULT_POLLING_INTERVAL); |
| 144 } | 142 } |
| 145 | 143 |
| 146 @Override | 144 @Override |
| 147 protected void runTest() throws Throwable { | 145 protected void runTest() throws Throwable { |
| 148 if (!getClass().getName().equals( | 146 if (!getClass().getPackage().getName().equals( |
| 149 CronetHttpURLConnectionTest.class.getName())) { | 147 "org.chromium.net.urlconnection")) { |
| 150 super.runTest(); | 148 super.runTest(); |
| 151 return; | 149 return; |
| 152 } | 150 } |
| 153 try { | 151 try { |
| 154 Method method = getClass().getMethod(getName(), (Class[]) null); | 152 Method method = getClass().getMethod(getName(), (Class[]) null); |
| 155 if (method.isAnnotationPresent(CompareDefaultWithCronet.class)) { | 153 if (method.isAnnotationPresent(CompareDefaultWithCronet.class)) { |
| 156 // Run with the default HttpURLConnection implementation first. | 154 // Run with the default HttpURLConnection implementation first. |
| 157 super.runTest(); | 155 super.runTest(); |
| 158 // Use Cronet's implementation, and run the same test. | 156 // Use Cronet's implementation, and run the same test. |
| 159 URL.setURLStreamHandlerFactory( | 157 URL.setURLStreamHandlerFactory( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 @Retention(RetentionPolicy.RUNTIME) | 201 @Retention(RetentionPolicy.RUNTIME) |
| 204 public @interface CompareDefaultWithCronet { | 202 public @interface CompareDefaultWithCronet { |
| 205 } | 203 } |
| 206 | 204 |
| 207 @Target(ElementType.METHOD) | 205 @Target(ElementType.METHOD) |
| 208 @Retention(RetentionPolicy.RUNTIME) | 206 @Retention(RetentionPolicy.RUNTIME) |
| 209 public @interface OnlyRunCronetHttpURLConnection { | 207 public @interface OnlyRunCronetHttpURLConnection { |
| 210 } | 208 } |
| 211 | 209 |
| 212 } | 210 } |
| OLD | NEW |