| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.os.ConditionVariable; | 7 import android.os.ConditionVariable; |
| 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 26 matching lines...) Expand all Loading... |
| 37 @SuppressWarnings("deprecation") | 37 @SuppressWarnings("deprecation") |
| 38 private void setUp(Sdch setting, Api api) { | 38 private void setUp(Sdch setting, Api api) { |
| 39 List<String> commandLineArgs = new ArrayList<String>(); | 39 List<String> commandLineArgs = new ArrayList<String>(); |
| 40 commandLineArgs.add(CronetTestFramework.CACHE_KEY); | 40 commandLineArgs.add(CronetTestFramework.CACHE_KEY); |
| 41 commandLineArgs.add(CronetTestFramework.CACHE_DISK); | 41 commandLineArgs.add(CronetTestFramework.CACHE_DISK); |
| 42 if (setting == Sdch.ENABLED) { | 42 if (setting == Sdch.ENABLED) { |
| 43 commandLineArgs.add(CronetTestFramework.SDCH_KEY); | 43 commandLineArgs.add(CronetTestFramework.SDCH_KEY); |
| 44 commandLineArgs.add(CronetTestFramework.SDCH_ENABLE); | 44 commandLineArgs.add(CronetTestFramework.SDCH_ENABLE); |
| 45 } | 45 } |
| 46 | 46 |
| 47 if (api == Api.LEGACY) { |
| 48 commandLineArgs.add(CronetTestFramework.LIBRARY_INIT_KEY); |
| 49 commandLineArgs.add(CronetTestFramework.LibraryInitType.LEGACY); |
| 50 } else { |
| 51 commandLineArgs.add(CronetTestFramework.LIBRARY_INIT_KEY); |
| 52 commandLineArgs.add(CronetTestFramework.LibraryInitType.CRONET); |
| 53 } |
| 54 |
| 47 String[] args = new String[commandLineArgs.size()]; | 55 String[] args = new String[commandLineArgs.size()]; |
| 48 mTestFramework = startCronetTestFrameworkWithUrlAndCommandLineArgs( | 56 mTestFramework = startCronetTestFrameworkWithUrlAndCommandLineArgs( |
| 49 null, commandLineArgs.toArray(args)); | 57 null, commandLineArgs.toArray(args)); |
| 50 long urlRequestContextAdapter = (api == Api.LEGACY) | 58 long urlRequestContextAdapter = (api == Api.LEGACY) |
| 51 ? getContextAdapter((ChromiumUrlRequestFactory) mTestFramework.m
RequestFactory) | 59 ? getContextAdapter((ChromiumUrlRequestFactory) mTestFramework.m
RequestFactory) |
| 52 : getContextAdapter((CronetUrlRequestContext) mTestFramework.mCr
onetEngine); | 60 : getContextAdapter((CronetUrlRequestContext) mTestFramework.mCr
onetEngine); |
| 53 NativeTestServer.registerHostResolverProc(urlRequestContextAdapter, api
== Api.LEGACY); | 61 NativeTestServer.registerHostResolverProc(urlRequestContextAdapter, api
== Api.LEGACY); |
| 54 // Start NativeTestServer. | 62 // Start NativeTestServer. |
| 55 assertTrue(NativeTestServer.startNativeTestServer(getContext())); | 63 assertTrue(NativeTestServer.startNativeTestServer(getContext())); |
| 56 } | 64 } |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 while ((line = reader.readLine()) != null) { | 280 while ((line = reader.readLine()) != null) { |
| 273 if (line.contains(content)) { | 281 if (line.contains(content)) { |
| 274 reader.close(); | 282 reader.close(); |
| 275 return true; | 283 return true; |
| 276 } | 284 } |
| 277 } | 285 } |
| 278 reader.close(); | 286 reader.close(); |
| 279 return false; | 287 return false; |
| 280 } | 288 } |
| 281 } | 289 } |
| OLD | NEW |