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 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
9 | 9 |
10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
11 import org.chromium.net.TestUrlRequestListener.ResponseStep; | 11 import org.chromium.net.TestUrlRequestListener.ResponseStep; |
12 | 12 |
13 /** | 13 /** |
14 * Tests that {@link CronetUrlRequest#getStatus} works as expected. | 14 * Tests that {@link CronetUrlRequest#getStatus} works as expected. |
15 */ | 15 */ |
16 public class GetStatusTest extends CronetTestBase { | 16 public class GetStatusTest extends CronetTestBase { |
17 private CronetTestActivity mActivity; | 17 private CronetTestActivity mActivity; |
18 | 18 |
19 private static class TestStatusListener implements StatusListener { | 19 private static class TestStatusListener extends StatusListener { |
20 boolean mOnStatusCalled = false; | 20 boolean mOnStatusCalled = false; |
21 int mStatus = Integer.MAX_VALUE; | 21 int mStatus = Integer.MAX_VALUE; |
22 private final ConditionVariable mBlock = new ConditionVariable(); | 22 private final ConditionVariable mBlock = new ConditionVariable(); |
23 | 23 |
24 @Override | 24 @Override |
25 public void onStatus(int status) { | 25 public void onStatus(int status) { |
26 mOnStatusCalled = true; | 26 mOnStatusCalled = true; |
27 mStatus = status; | 27 mStatus = status; |
28 mBlock.open(); | 28 mBlock.open(); |
29 } | 29 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 try { | 123 try { |
124 RequestStatus.convertLoadState(16); | 124 RequestStatus.convertLoadState(16); |
125 fail(); | 125 fail(); |
126 } catch (AssertionError e) { | 126 } catch (AssertionError e) { |
127 // Expected. | 127 // Expected. |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 } | 131 } |
OLD | NEW |