| 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.os.Build; | 7 import android.os.Build; |
| 8 import android.os.ConditionVariable; | 8 import android.os.ConditionVariable; |
| 9 import android.os.StrictMode; | 9 import android.os.StrictMode; |
| 10 import android.support.test.filters.SmallTest; | 10 import android.support.test.filters.SmallTest; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 headers[i], headers[i + 1])); | 147 headers[i], headers[i + 1])); |
| 148 } | 148 } |
| 149 UrlResponseInfoImpl unknown = new UrlResponseInfoImpl( | 149 UrlResponseInfoImpl unknown = new UrlResponseInfoImpl( |
| 150 Arrays.asList(urls), statusCode, message, headersList, false, "u
nknown", ":0"); | 150 Arrays.asList(urls), statusCode, message, headersList, false, "u
nknown", ":0"); |
| 151 unknown.setReceivedByteCount(receivedBytes); | 151 unknown.setReceivedByteCount(receivedBytes); |
| 152 return unknown; | 152 return unknown; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void runConnectionMigrationTest(boolean disableConnectionMigration) { | 155 void runConnectionMigrationTest(boolean disableConnectionMigration) { |
| 156 // URLRequest load flags at net/base/load_flags_list.h. | 156 // URLRequest load flags at net/base/load_flags_list.h. |
| 157 int connectionMigrationLoadFlag = 1 << 18; | 157 int connectionMigrationLoadFlag = 1 << 17; |
| 158 TestUrlRequestCallback callback = new TestUrlRequestCallback(); | 158 TestUrlRequestCallback callback = new TestUrlRequestCallback(); |
| 159 callback.setAutoAdvance(false); | 159 callback.setAutoAdvance(false); |
| 160 // Create builder, start a request, and check if default load_flags are
set correctly. | 160 // Create builder, start a request, and check if default load_flags are
set correctly. |
| 161 ExperimentalUrlRequest.Builder builder = | 161 ExperimentalUrlRequest.Builder builder = |
| 162 (ExperimentalUrlRequest.Builder) mTestFramework.mCronetEngine.ne
wUrlRequestBuilder( | 162 (ExperimentalUrlRequest.Builder) mTestFramework.mCronetEngine.ne
wUrlRequestBuilder( |
| 163 NativeTestServer.getFileURL("/success.txt"), callback, | 163 NativeTestServer.getFileURL("/success.txt"), callback, |
| 164 callback.getExecutor()); | 164 callback.getExecutor()); |
| 165 // Disable connection migration. | 165 // Disable connection migration. |
| 166 if (disableConnectionMigration) builder.disableConnectionMigration(); | 166 if (disableConnectionMigration) builder.disableConnectionMigration(); |
| 167 UrlRequest urlRequest = builder.build(); | 167 UrlRequest urlRequest = builder.build(); |
| (...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2112 // cleartext. | 2112 // cleartext. |
| 2113 final String url = "http://example.com/simple.txt"; | 2113 final String url = "http://example.com/simple.txt"; |
| 2114 TestUrlRequestCallback callback = startAndWaitForComplete(url); | 2114 TestUrlRequestCallback callback = startAndWaitForComplete(url); |
| 2115 assertNull(callback.mResponseInfo); | 2115 assertNull(callback.mResponseInfo); |
| 2116 assertNotNull(callback.mError); | 2116 assertNotNull(callback.mError); |
| 2117 assertEquals(cleartextNotPermitted, | 2117 assertEquals(cleartextNotPermitted, |
| 2118 ((NetworkException) callback.mError).getCronetInternalErrorC
ode()); | 2118 ((NetworkException) callback.mError).getCronetInternalErrorC
ode()); |
| 2119 } | 2119 } |
| 2120 } | 2120 } |
| 2121 } | 2121 } |
| OLD | NEW |