Chromium Code Reviews| 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.util.Log; | 7 import android.util.Log; |
| 8 | 8 |
| 9 import org.apache.http.conn.ConnectTimeoutException; | 9 import org.apache.http.conn.ConnectTimeoutException; |
| 10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 ResponseHeadersMap result = new ResponseHeadersMap(); | 430 ResponseHeadersMap result = new ResponseHeadersMap(); |
| 431 nativeGetAllHeaders(mUrlRequestAdapter, result); | 431 nativeGetAllHeaders(mUrlRequestAdapter, result); |
| 432 return result; | 432 return result; |
| 433 } | 433 } |
| 434 | 434 |
| 435 @Override | 435 @Override |
| 436 public String getUrl() { | 436 public String getUrl() { |
| 437 return mUrl; | 437 return mUrl; |
| 438 } | 438 } |
| 439 | 439 |
| 440 /** | |
| 441 * Resets native request adapter object. This should only be used in tests. | |
| 442 */ | |
| 443 public void resetAdapterForTesting() { | |
|
mmenke
2015/02/20 23:19:43
Rather than have this method, can we run tests on
xunjieli
2015/02/25 21:31:28
Done.
| |
| 444 mUrlRequestAdapter = 0; | |
| 445 } | |
| 446 | |
| 440 private static int convertRequestPriority(int priority) { | 447 private static int convertRequestPriority(int priority) { |
| 441 switch (priority) { | 448 switch (priority) { |
| 442 case HttpUrlRequest.REQUEST_PRIORITY_IDLE: | 449 case HttpUrlRequest.REQUEST_PRIORITY_IDLE: |
| 443 return ChromiumUrlRequestPriority.IDLE; | 450 return ChromiumUrlRequestPriority.IDLE; |
| 444 case HttpUrlRequest.REQUEST_PRIORITY_LOWEST: | 451 case HttpUrlRequest.REQUEST_PRIORITY_LOWEST: |
| 445 return ChromiumUrlRequestPriority.LOWEST; | 452 return ChromiumUrlRequestPriority.LOWEST; |
| 446 case HttpUrlRequest.REQUEST_PRIORITY_LOW: | 453 case HttpUrlRequest.REQUEST_PRIORITY_LOW: |
| 447 return ChromiumUrlRequestPriority.LOW; | 454 return ChromiumUrlRequestPriority.LOW; |
| 448 case HttpUrlRequest.REQUEST_PRIORITY_MEDIUM: | 455 case HttpUrlRequest.REQUEST_PRIORITY_MEDIUM: |
| 449 return ChromiumUrlRequestPriority.MEDIUM; | 456 return ChromiumUrlRequestPriority.MEDIUM; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 private native void nativeGetAllHeaders(long urlRequestAdapter, | 727 private native void nativeGetAllHeaders(long urlRequestAdapter, |
| 721 ResponseHeadersMap headers); | 728 ResponseHeadersMap headers); |
| 722 | 729 |
| 723 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); | 730 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); |
| 724 | 731 |
| 725 // Explicit class to work around JNI-generator generics confusion. | 732 // Explicit class to work around JNI-generator generics confusion. |
| 726 private static class ResponseHeadersMap extends | 733 private static class ResponseHeadersMap extends |
| 727 HashMap<String, List<String>> { | 734 HashMap<String, List<String>> { |
| 728 } | 735 } |
| 729 } | 736 } |
| OLD | NEW |