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 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 fail(); | 2029 fail(); |
2030 } | 2030 } |
2031 | 2031 |
2032 @Override | 2032 @Override |
2033 public void onSucceeded(UrlRequest request, UrlResponseInfo info) { | 2033 public void onSucceeded(UrlRequest request, UrlResponseInfo info) { |
2034 failedExpectation.set(true); | 2034 failedExpectation.set(true); |
2035 fail(); | 2035 fail(); |
2036 } | 2036 } |
2037 | 2037 |
2038 @Override | 2038 @Override |
2039 public void onFailed( | 2039 public void onFailed(UrlRequest request, UrlResponseInfo info, Crone
tException error) { |
2040 UrlRequest request, UrlResponseInfo info, UrlRequestExceptio
n error) { | 2040 assertTrue(error instanceof NetworkException); |
2041 assertEquals(netError, error.getCronetInternalErrorCode()); | 2041 assertEquals(netError, ((NetworkException) error).getCronetInter
nalErrorCode()); |
2042 failedExpectation.set(error.getCronetInternalErrorCode() != netE
rror); | 2042 failedExpectation.set( |
| 2043 ((NetworkException) error).getCronetInternalErrorCode()
!= netError); |
2043 done.open(); | 2044 done.open(); |
2044 } | 2045 } |
2045 | 2046 |
2046 @Override | 2047 @Override |
2047 public void onCanceled(UrlRequest request, UrlResponseInfo info) { | 2048 public void onCanceled(UrlRequest request, UrlResponseInfo info) { |
2048 failedExpectation.set(true); | 2049 failedExpectation.set(true); |
2049 fail(); | 2050 fail(); |
2050 } | 2051 } |
2051 }; | 2052 }; |
2052 | 2053 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 // cleartext. | 2109 // cleartext. |
2109 final String url = "http://example.com/simple.txt"; | 2110 final String url = "http://example.com/simple.txt"; |
2110 TestUrlRequestCallback callback = startAndWaitForComplete(url); | 2111 TestUrlRequestCallback callback = startAndWaitForComplete(url); |
2111 assertNull(callback.mResponseInfo); | 2112 assertNull(callback.mResponseInfo); |
2112 assertNotNull(callback.mError); | 2113 assertNotNull(callback.mError); |
2113 assertEquals(cleartextNotPermitted, | 2114 assertEquals(cleartextNotPermitted, |
2114 ((NetworkException) callback.mError).getCronetInternalErrorC
ode()); | 2115 ((NetworkException) callback.mError).getCronetInternalErrorC
ode()); |
2115 } | 2116 } |
2116 } | 2117 } |
2117 } | 2118 } |
OLD | NEW |