| 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.ContextWrapper; | 7 import android.content.ContextWrapper; |
| 8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
| 9 | 9 |
| 10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 @SmallTest | 133 @SmallTest |
| 134 @Feature({"Cronet"}) | 134 @Feature({"Cronet"}) |
| 135 public void testInitDifferentContexts() throws Exception { | 135 public void testInitDifferentContexts() throws Exception { |
| 136 // Test that concurrently instantiating ChromiumUrlRequestContext's upon | 136 // Test that concurrently instantiating ChromiumUrlRequestContext's upon |
| 137 // various different versions of the same Android Context does not cause | 137 // various different versions of the same Android Context does not cause |
| 138 // crashes like crbug.com/453845 | 138 // crashes like crbug.com/453845 |
| 139 final CronetTestActivity activity = launchCronetTestApp(); | 139 final CronetTestActivity activity = launchCronetTestApp(); |
| 140 HttpUrlRequestFactory firstFactory = | 140 HttpUrlRequestFactory firstFactory = |
| 141 HttpUrlRequestFactory.createFactory(activity, activity.getContex
tConfig()); | 141 HttpUrlRequestFactory.createFactory(activity.createCronetEngineB
uilder(activity)); |
| 142 HttpUrlRequestFactory secondFactory = HttpUrlRequestFactory.createFactor
y( | 142 HttpUrlRequestFactory secondFactory = HttpUrlRequestFactory.createFactor
y( |
| 143 activity.getApplicationContext(), activity.getContextConfig()); | 143 activity.createCronetEngineBuilder(activity.getApplicationContex
t())); |
| 144 HttpUrlRequestFactory thirdFactory = HttpUrlRequestFactory.createFactory
( | 144 HttpUrlRequestFactory thirdFactory = HttpUrlRequestFactory.createFactory
( |
| 145 new ContextWrapper(activity), activity.getContextConfig()); | 145 activity.createCronetEngineBuilder(new ContextWrapper(activity))
); |
| 146 // Meager attempt to extend lifetimes to ensure they're concurrently | 146 // Meager attempt to extend lifetimes to ensure they're concurrently |
| 147 // alive. | 147 // alive. |
| 148 firstFactory.getName(); | 148 firstFactory.getName(); |
| 149 secondFactory.getName(); | 149 secondFactory.getName(); |
| 150 thirdFactory.getName(); | 150 thirdFactory.getName(); |
| 151 } | 151 } |
| 152 } | 152 } |
| OLD | NEW |