Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java

Issue 2406273002: [Cronet] Test the libcronet that's shipped, not libcronet_test (Closed)
Patch Set: fix perf test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.impl; 5 package org.chromium.net.impl;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Build; 8 import android.os.Build;
9 import android.os.ConditionVariable; 9 import android.os.ConditionVariable;
10 import android.os.Handler; 10 import android.os.Handler;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 471 }
472 472
473 @VisibleForTesting 473 @VisibleForTesting
474 public long getUrlRequestContextAdapter() { 474 public long getUrlRequestContextAdapter() {
475 synchronized (mLock) { 475 synchronized (mLock) {
476 checkHaveAdapter(); 476 checkHaveAdapter();
477 return mUrlRequestContextAdapter; 477 return mUrlRequestContextAdapter;
478 } 478 }
479 } 479 }
480 480
481 @VisibleForTesting
482 public long getUrlRequestContextForTesting() {
483 synchronized (mLock) {
484 checkHaveAdapter();
485 return nativeGetUrlRequestContextForTesting(mUrlRequestContextAdapte r);
486 }
487 }
488
481 @GuardedBy("mLock") 489 @GuardedBy("mLock")
482 private void checkHaveAdapter() throws IllegalStateException { 490 private void checkHaveAdapter() throws IllegalStateException {
483 if (!haveRequestContextAdapter()) { 491 if (!haveRequestContextAdapter()) {
484 throw new IllegalStateException("Engine is shut down."); 492 throw new IllegalStateException("Engine is shut down.");
485 } 493 }
486 } 494 }
487 495
488 @GuardedBy("mLock") 496 @GuardedBy("mLock")
489 private boolean haveRequestContextAdapter() { 497 private boolean haveRequestContextAdapter() {
490 return mUrlRequestContextAdapter != 0; 498 return mUrlRequestContextAdapter != 0;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 642 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
635 private native void nativeConfigureNetworkQualityEstimatorForTesting( 643 private native void nativeConfigureNetworkQualityEstimatorForTesting(
636 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp onses); 644 long nativePtr, boolean useLocalHostRequests, boolean useSmallerResp onses);
637 645
638 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 646 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
639 private native void nativeProvideRTTObservations(long nativePtr, boolean sho uld); 647 private native void nativeProvideRTTObservations(long nativePtr, boolean sho uld);
640 648
641 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 649 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
642 private native void nativeProvideThroughputObservations(long nativePtr, bool ean should); 650 private native void nativeProvideThroughputObservations(long nativePtr, bool ean should);
643 651
652 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
653 private native long nativeGetUrlRequestContextForTesting(long nativePtr);
654
644 public boolean isNetworkThread(Thread thread) { 655 public boolean isNetworkThread(Thread thread) {
645 return thread == mNetworkThread; 656 return thread == mNetworkThread;
646 } 657 }
647 } 658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698