| OLD | NEW |
| 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; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 @Override | 273 @Override |
| 274 public void close() throws IOException { | 274 public void close() throws IOException { |
| 275 if (!mClosed.compareAndSet(false, true)) { | 275 if (!mClosed.compareAndSet(false, true)) { |
| 276 throw new AssertionError("Closed twice"); | 276 throw new AssertionError("Closed twice"); |
| 277 } | 277 } |
| 278 mAwaitingClose.open(); | 278 mAwaitingClose.open(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 public void assertClosed() { | 281 public void assertClosed() { |
| 282 mAwaitingClose.block(); | 282 mAwaitingClose.block(5000); |
| 283 if (!mClosed.get()) { | 283 if (!mClosed.get()) { |
| 284 throw new AssertionError("Was not closed"); | 284 throw new AssertionError("Was not closed"); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |