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

Side by Side Diff: components/cronet/android/test/javatests/src/org/chromium/net/TestDrivenDataProvider.java

Issue 1307863006: [Cronet] Change interface APIs to abstract classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update CronetPerfTestActivity too Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.ConditionVariable; 7 import android.os.ConditionVariable;
8 8
9 import java.io.IOException; 9 import java.io.IOException;
10 import java.nio.ByteBuffer; 10 import java.nio.ByteBuffer;
11 import java.util.List; 11 import java.util.List;
12 import java.util.concurrent.Executor; 12 import java.util.concurrent.Executor;
13 13
14 /** 14 /**
15 * An UploadDataProvider that allows tests to invoke {@code onReadSucceeded} 15 * An UploadDataProvider that allows tests to invoke {@code onReadSucceeded}
16 * and {@code onRewindSucceeded} on the UploadDataSink directly. 16 * and {@code onRewindSucceeded} on the UploadDataSink directly.
17 * Chunked mode is not supported here, since the main interest is to test 17 * Chunked mode is not supported here, since the main interest is to test
18 * different order of init/read/rewind calls. 18 * different order of init/read/rewind calls.
19 */ 19 */
20 class TestDrivenDataProvider implements UploadDataProvider { 20 class TestDrivenDataProvider extends UploadDataProvider {
21 private final Executor mExecutor; 21 private final Executor mExecutor;
22 private final List<byte[]> mReads; 22 private final List<byte[]> mReads;
23 private final ConditionVariable mWaitForReadRequest = 23 private final ConditionVariable mWaitForReadRequest =
24 new ConditionVariable(); 24 new ConditionVariable();
25 private final ConditionVariable mWaitForRewindRequest = 25 private final ConditionVariable mWaitForRewindRequest =
26 new ConditionVariable(); 26 new ConditionVariable();
27 // Lock used to synchronize access to mReadPending and mRewindPending. 27 // Lock used to synchronize access to mReadPending and mRewindPending.
28 private final Object mLock = new Object(); 28 private final Object mLock = new Object();
29 29
30 private int mNextRead = 0; 30 private int mNextRead = 0;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 /** 185 /**
186 * Helper method to ensure no read or rewind is in progress. 186 * Helper method to ensure no read or rewind is in progress.
187 */ 187 */
188 private void assertIdle() { 188 private void assertIdle() {
189 assertReadNotPending(); 189 assertReadNotPending();
190 assertRewindNotPending(); 190 assertRewindNotPending();
191 } 191 }
192 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698