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

Unified Diff: components/cronet/android/test/smoketests/src/org/chromium/net/smoke/TestSupport.java

Issue 2561803002: Cronet smoke tests (Closed)
Patch Set: Moved to android.support.test.filters & added support for network-security-config Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cronet/android/test/smoketests/src/org/chromium/net/smoke/SmokeTestRequestCallback.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/test/smoketests/src/org/chromium/net/smoke/TestSupport.java
diff --git a/components/cronet/android/test/smoketests/src/org/chromium/net/smoke/TestSupport.java b/components/cronet/android/test/smoketests/src/org/chromium/net/smoke/TestSupport.java
new file mode 100644
index 0000000000000000000000000000000000000000..f2051065c688d85efdab606d347afcb4e4da6f88
--- /dev/null
+++ b/components/cronet/android/test/smoketests/src/org/chromium/net/smoke/TestSupport.java
@@ -0,0 +1,93 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.net.smoke;
+
+import android.content.Context;
+
+import org.json.JSONObject;
+
+import org.chromium.net.ExperimentalCronetEngine;
+
+import java.io.File;
+
+/**
+ * Provides support for tests, so they can be run in different environments against different
+ * servers. It contains methods, which behavior can be different in different testing environments.
+ * The concrete implementation of this interface is determined dynamically at runtime by reading
+ * the value of |TestSupportImplClass| from the Android string resource file.
+ */
+public interface TestSupport {
+ enum Protocol {
+ HTTP1,
+ HTTP2,
+ QUIC,
+ }
+
+ /**
+ * Creates a new test server that supports a given {@code protocol}.
+ *
+ * @param context context.
+ * @param protocol protocol that should be supported by the server.
+ * @return an instance of the server.
+ *
+ * @throws UnsupportedOperationException if the implementation of this interface
+ * does not support a given {@code protocol}.
+ */
+ TestServer createTestServer(Context context, Protocol protocol);
+
+ /**
+ * This method is called at the end of a test run if the netlog is available. An implementer
+ * of {@link TestSupport} can use it to process the result netlog; e.g., to copy the netlog
+ * to a directory where all test logs are collected. This method is optional and can be no-op.
+ *
+ * @param file the netlog file.
+ */
+ void processNetLog(Context context, File file);
+
+ /**
+ * Adds host resolver rules to a given experimental option JSON file.
+ * This method is optional.
+ *
+ * @param experimentalOptionsJson experimental options.
+ */
+ void addHostResolverRules(JSONObject experimentalOptionsJson);
+
+ /**
+ * Installs mock certificate verifier for a given {@code builder}.
+ * This method is optional.
+ *
+ * @param builder that should have the verifier installed.
+ */
+ void installMockCertVerifierForTesting(ExperimentalCronetEngine.Builder builder);
+
+ /**
+ * Loads a native library that is required for testing if any required.
+ */
+ void loadTestNativeLibrary();
+
+ /**
+ * A test server.
+ */
+ interface TestServer {
+ /**
+ * Starts the server.
+ *
+ * @return true if the server started successfully.
+ */
+ boolean start();
+
+ /**
+ * Shuts down the server.
+ */
+ void shutdown();
+
+ /**
+ * Return a URL that can be used by the test code to receive a successful response.
+ *
+ * @return the URL as a string.
+ */
+ String getSuccessURL();
+ }
+}
« no previous file with comments | « components/cronet/android/test/smoketests/src/org/chromium/net/smoke/SmokeTestRequestCallback.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698