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 static junit.framework.Assert.assertTrue; | 7 import static junit.framework.Assert.assertTrue; |
8 | 8 |
9 import org.chromium.base.annotations.JNINamespace; | 9 import org.chromium.base.annotations.JNINamespace; |
10 import org.chromium.net.test.FailurePhase; | 10 import org.chromium.net.test.FailurePhase; |
(...skipping 16 matching lines...) Expand all Loading... |
27 * @param phase at which request fails. It should be a value in | 27 * @param phase at which request fails. It should be a value in |
28 * org.chromium.net.test.FailurePhase. | 28 * org.chromium.net.test.FailurePhase. |
29 * @param netError reported by UrlRequestJob. Passing -1, results in hang. | 29 * @param netError reported by UrlRequestJob. Passing -1, results in hang. |
30 */ | 30 */ |
31 public static String getMockUrlWithFailure(int phase, int netError) { | 31 public static String getMockUrlWithFailure(int phase, int netError) { |
32 assertTrue(netError < 0); | 32 assertTrue(netError < 0); |
33 switch (phase) { | 33 switch (phase) { |
34 case FailurePhase.START: | 34 case FailurePhase.START: |
35 case FailurePhase.READ_SYNC: | 35 case FailurePhase.READ_SYNC: |
36 case FailurePhase.READ_ASYNC: | 36 case FailurePhase.READ_ASYNC: |
| 37 case FailurePhase.CERT_REQUESTED: |
37 break; | 38 break; |
38 default: | 39 default: |
39 throw new IllegalArgumentException( | 40 throw new IllegalArgumentException( |
40 "phase not in org.chromium.net.test.FailurePhase"); | 41 "phase not in org.chromium.net.test.FailurePhase"); |
41 } | 42 } |
42 return nativeGetMockUrlWithFailure(phase, netError); | 43 return nativeGetMockUrlWithFailure(phase, netError); |
43 } | 44 } |
44 | 45 |
45 /** | 46 /** |
46 * Constructs a mock URL that synchronously responds with data repeated many | 47 * Constructs a mock URL that synchronously responds with data repeated many |
(...skipping 15 matching lines...) Expand all Loading... |
62 | 63 |
63 private static native void nativeAddUrlInterceptors(); | 64 private static native void nativeAddUrlInterceptors(); |
64 | 65 |
65 private static native String nativeGetMockUrlWithFailure(int phase, int netE
rror); | 66 private static native String nativeGetMockUrlWithFailure(int phase, int netE
rror); |
66 | 67 |
67 private static native String nativeGetMockUrlForData(String data, | 68 private static native String nativeGetMockUrlForData(String data, |
68 int dataRepeatCount); | 69 int dataRepeatCount); |
69 | 70 |
70 private static native String nativeGetMockUrlForSSLCertificateError(); | 71 private static native String nativeGetMockUrlForSSLCertificateError(); |
71 } | 72 } |
OLD | NEW |