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

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

Issue 1000793002: [Android] Incorporate findbugs into android builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 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; 5 package org.chromium.net;
6 6
7 import android.test.suitebuilder.annotation.LargeTest; 7 import android.test.suitebuilder.annotation.LargeTest;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 9
10 import org.chromium.base.annotations.SuppressFBWarnings;
10 import org.chromium.base.test.util.Feature; 11 import org.chromium.base.test.util.Feature;
11 12
12 import java.io.IOException; 13 import java.io.IOException;
13 import java.nio.ByteBuffer; 14 import java.nio.ByteBuffer;
14 import java.util.HashMap; 15 import java.util.HashMap;
15 import java.util.List; 16 import java.util.List;
16 import java.util.concurrent.Executors; 17 import java.util.concurrent.Executors;
17 18
18 /** 19 /**
19 * Tests that use mock URLRequestJobs to simulate URL requests. 20 * Tests that use mock URLRequestJobs to simulate URL requests.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 Executors.newCachedThreadPool().execute(cancelTask); 246 Executors.newCachedThreadPool().execute(cancelTask);
246 listener.blockForComplete(); 247 listener.blockForComplete();
247 assertFalse(channel.isOpen()); 248 assertFalse(channel.isOpen());
248 // Since getAllHeaders and other methods in 249 // Since getAllHeaders and other methods in
249 // checkAfterAdapterDestroyed() acquire mLock, so this will happen 250 // checkAfterAdapterDestroyed() acquire mLock, so this will happen
250 // after the adapter is destroyed. 251 // after the adapter is destroyed.
251 checkAfterAdapterDestroyed(request); 252 checkAfterAdapterDestroyed(request);
252 } 253 }
253 } 254 }
254 255
256 @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
mef 2015/03/23 19:28:10 Is DLS_DEAD_LOCAL_STORE complaining about value be
jbudorick 2015/03/23 19:49:21 Yes; see the entry for DLS_DEAD_LOCAL_STORE in htt
255 @SmallTest 257 @SmallTest
256 @Feature({"Cronet"}) 258 @Feature({"Cronet"})
257 public void testNoWriteAfterSyncCancel() throws Exception { 259 public void testNoWriteAfterSyncCancel() throws Exception {
258 HashMap<String, String> headers = new HashMap<String, String>(); 260 HashMap<String, String> headers = new HashMap<String, String>();
259 TestByteChannel channel = new TestByteChannel(); 261 TestByteChannel channel = new TestByteChannel();
260 TestHttpUrlRequestListener listener = new TestHttpUrlRequestListener(); 262 TestHttpUrlRequestListener listener = new TestHttpUrlRequestListener();
261 263
262 String data = "MyBigFunkyData"; 264 String data = "MyBigFunkyData";
263 int dataLength = data.length(); 265 int dataLength = data.length();
264 int repeatCount = 10000; 266 int repeatCount = 10000;
(...skipping 29 matching lines...) Expand all
294 String mockUrl = mMockUrlRequestJobFactory.getMockUrlForData(data, 296 String mockUrl = mMockUrlRequestJobFactory.getMockUrlForData(data,
295 repeatCount); 297 repeatCount);
296 createRequestAndWaitForComplete(mockUrl, false); 298 createRequestAndWaitForComplete(mockUrl, false);
297 assertEquals(mockUrl, mListener.mUrl); 299 assertEquals(mockUrl, mListener.mUrl);
298 for (int i = 0; i < repeatCount; ++i) { 300 for (int i = 0; i < repeatCount; ++i) {
299 assertEquals(data, mListener.mResponseAsString.substring( 301 assertEquals(data, mListener.mResponseAsString.substring(
300 dataLength * i, dataLength * (i + 1))); 302 dataLength * i, dataLength * (i + 1)));
301 } 303 }
302 } 304 }
303 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698