1 // Copyright 2016 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.net.smoke;
6 
7 import android.content.Context;
8 
9 import org.json.JSONObject;
10 
11 import org.chromium.net.ExperimentalCronetEngine;
12 import org.chromium.net.smoke.TestSupport.Protocol;
13 import org.chromium.net.smoke.TestSupport.TestServer;
14 
15 import java.io.File;
16 
17 /**
18  * Tests support for Java only Cronet engine tests. This class should not depend on
19  * Chromium 'base' or 'net'.
20  */
21 public class ChromiumPlatformOnlyTestSupport implements TestSupport {
22     @Override
createTestServer(Context context, Protocol protocol)23     public TestServer createTestServer(Context context, Protocol protocol) {
24         switch (protocol) {
25             case QUIC:
26                 throw new IllegalArgumentException("QUIC is not supported");
27             case HTTP2:
28                 throw new IllegalArgumentException("HTTP2 is not supported");
29             case HTTP1:
30                 return new HttpTestServer();
31             default:
32                 throw new IllegalArgumentException("Unknown server protocol: " + protocol);
33         }
34     }
35 
36     @Override
processNetLog(Context context, File file)37     public void processNetLog(Context context, File file) {
38         // Do nothing
39     }
40 
41     @Override
addHostResolverRules(JSONObject experimentalOptionsJson)42     public void addHostResolverRules(JSONObject experimentalOptionsJson) {
43         throw new UnsupportedOperationException("Unsupported by ChromiumPlatformOnlyTestSupport");
44     }
45 
46     @Override
installMockCertVerifierForTesting(ExperimentalCronetEngine.Builder builder)47     public void installMockCertVerifierForTesting(ExperimentalCronetEngine.Builder builder) {
48         throw new UnsupportedOperationException("Unsupported by ChromiumPlatformOnlyTestSupport");
49     }
50 
51     @Override
loadTestNativeLibrary()52     public void loadTestNativeLibrary() {
53         throw new UnsupportedOperationException("Unsupported by ChromiumPlatformOnlyTestSupport");
54     }
55 }
56