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.PathUtils; | 9 import org.chromium.base.PathUtils; |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 /** | 57 /** |
58 * Starts the CronetTest framework appending the provided command line | 58 * Starts the CronetTest framework appending the provided command line |
59 * arguments and loads the given URL. The URL can be null. | 59 * arguments and loads the given URL. The URL can be null. |
60 */ | 60 */ |
61 protected CronetTestFramework startCronetTestFrameworkWithUrlAndCommandLineA
rgs( | 61 protected CronetTestFramework startCronetTestFrameworkWithUrlAndCommandLineA
rgs( |
62 String url, String[] commandLineArgs) { | 62 String url, String[] commandLineArgs) { |
63 mCronetTestFramework = new CronetTestFramework(url, commandLineArgs, get
Context(), null); | 63 mCronetTestFramework = new CronetTestFramework(url, commandLineArgs, get
Context(), null); |
64 return mCronetTestFramework; | 64 return mCronetTestFramework; |
65 } | 65 } |
66 | 66 |
67 // Helper method to tell the framework to skip factory init during construct
ion. | 67 // Helper method to tell the framework to skip library init during construct
ion. |
68 protected CronetTestFramework startCronetTestFrameworkAndSkipFactoryInit() { | 68 protected CronetTestFramework startCronetTestFrameworkAndSkipLibraryInit() { |
69 String[] commandLineArgs = { | 69 String[] commandLineArgs = { |
70 CronetTestFramework.LIBRARY_INIT_KEY, CronetTestFramework.LIBRAR
Y_INIT_SKIP}; | 70 CronetTestFramework.LIBRARY_INIT_KEY, CronetTestFramework.Librar
yInitType.NONE}; |
71 mCronetTestFramework = | 71 mCronetTestFramework = |
72 startCronetTestFrameworkWithUrlAndCommandLineArgs(null, commandL
ineArgs); | 72 startCronetTestFrameworkWithUrlAndCommandLineArgs(null, commandL
ineArgs); |
73 return mCronetTestFramework; | 73 return mCronetTestFramework; |
74 } | 74 } |
75 | 75 |
| 76 /** |
| 77 * Starts the CronetTest framework for the legacy API. |
| 78 * @param url if non-null, a request will be made with that url. |
| 79 */ |
| 80 protected CronetTestFramework startCronetTestFrameworkForLegacyApi(String ur
l) { |
| 81 String[] commandLineArgs = { |
| 82 CronetTestFramework.LIBRARY_INIT_KEY, CronetTestFramework.Librar
yInitType.LEGACY}; |
| 83 mCronetTestFramework = |
| 84 startCronetTestFrameworkWithUrlAndCommandLineArgs(url, commandLi
neArgs); |
| 85 return mCronetTestFramework; |
| 86 } |
| 87 |
76 @Override | 88 @Override |
77 protected void runTest() throws Throwable { | 89 protected void runTest() throws Throwable { |
78 if (!getClass().getPackage().getName().equals( | 90 if (!getClass().getPackage().getName().equals( |
79 "org.chromium.net.urlconnection")) { | 91 "org.chromium.net.urlconnection")) { |
80 super.runTest(); | 92 super.runTest(); |
81 return; | 93 return; |
82 } | 94 } |
83 try { | 95 try { |
84 Method method = getClass().getMethod(getName(), (Class[]) null); | 96 Method method = getClass().getMethod(getName(), (Class[]) null); |
85 if (method.isAnnotationPresent(CompareDefaultWithCronet.class)) { | 97 if (method.isAnnotationPresent(CompareDefaultWithCronet.class)) { |
(...skipping 20 matching lines...) Expand all Loading... |
106 @Retention(RetentionPolicy.RUNTIME) | 118 @Retention(RetentionPolicy.RUNTIME) |
107 public @interface CompareDefaultWithCronet { | 119 public @interface CompareDefaultWithCronet { |
108 } | 120 } |
109 | 121 |
110 @Target(ElementType.METHOD) | 122 @Target(ElementType.METHOD) |
111 @Retention(RetentionPolicy.RUNTIME) | 123 @Retention(RetentionPolicy.RUNTIME) |
112 public @interface OnlyRunCronetHttpURLConnection { | 124 public @interface OnlyRunCronetHttpURLConnection { |
113 } | 125 } |
114 | 126 |
115 } | 127 } |
OLD | NEW |