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

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

Issue 2909223004: [Cronet] Add null-check to avoid crashing case where no tests are run (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.support.test.filters.SmallTest; 7 import android.support.test.filters.SmallTest;
8 8
9 import org.chromium.base.test.util.Feature; 9 import org.chromium.base.test.util.Feature;
10 10
11 /** 11 /**
12 * Simple test for Brotli support. 12 * Simple test for Brotli support.
13 */ 13 */
14 public class BrotliTest extends CronetTestBase { 14 public class BrotliTest extends CronetTestBase {
15 private CronetEngine mCronetEngine; 15 private CronetEngine mCronetEngine;
16 16
17 @Override 17 @Override
18 protected void setUp() throws Exception { 18 protected void setUp() throws Exception {
19 super.setUp(); 19 super.setUp();
20 // Load library first to create MockCertVerifier.
21 System.loadLibrary("cronet_tests");
22 assertTrue(Http2TestServer.startHttp2TestServer( 20 assertTrue(Http2TestServer.startHttp2TestServer(
23 getContext(), SERVER_CERT_PEM, SERVER_KEY_PKCS8_PEM)); 21 getContext(), SERVER_CERT_PEM, SERVER_KEY_PKCS8_PEM));
24 } 22 }
25 23
26 @Override 24 @Override
27 protected void tearDown() throws Exception { 25 protected void tearDown() throws Exception {
28 assertTrue(Http2TestServer.shutdownHttp2TestServer()); 26 assertTrue(Http2TestServer.shutdownHttp2TestServer());
29 mCronetEngine.shutdown(); 27 if (mCronetEngine != null) {
28 mCronetEngine.shutdown();
29 }
30 super.tearDown(); 30 super.tearDown();
31 } 31 }
32 32
33 @SmallTest 33 @SmallTest
34 @Feature({"Cronet"}) 34 @Feature({"Cronet"})
35 @OnlyRunNativeCronet 35 @OnlyRunNativeCronet
36 public void testBrotliAdvertised() throws Exception { 36 public void testBrotliAdvertised() throws Exception {
37 ExperimentalCronetEngine.Builder builder = 37 ExperimentalCronetEngine.Builder builder =
38 new ExperimentalCronetEngine.Builder(getContext()); 38 new ExperimentalCronetEngine.Builder(getContext());
39 builder.enableBrotli(true); 39 builder.enableBrotli(true);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 private TestUrlRequestCallback startAndWaitForComplete(String url) { 82 private TestUrlRequestCallback startAndWaitForComplete(String url) {
83 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 83 TestUrlRequestCallback callback = new TestUrlRequestCallback();
84 UrlRequest.Builder builder = 84 UrlRequest.Builder builder =
85 mCronetEngine.newUrlRequestBuilder(url, callback, callback.getEx ecutor()); 85 mCronetEngine.newUrlRequestBuilder(url, callback, callback.getEx ecutor());
86 builder.build().start(); 86 builder.build().start();
87 callback.blockForDone(); 87 callback.blockForDone();
88 return callback; 88 return callback;
89 } 89 }
90 } 90 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698