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

Unified Diff: android_webview/test/shell/src/org/chromium/android_webview/test/ServiceTestRunner.java

Issue 2201783003: Add test to ensure shouldOverrideUrlLoading throws Java exception (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add testbase for separate-service tests, use this from AwSecondBrowserTest. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/test/shell/src/org/chromium/android_webview/test/ServiceTestRunner.java
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/ServiceTestRunner.java b/android_webview/test/shell/src/org/chromium/android_webview/test/ServiceTestRunner.java
new file mode 100644
index 0000000000000000000000000000000000000000..6cbe1838d60271002b10242334beb21bb5c70a90
--- /dev/null
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/ServiceTestRunner.java
@@ -0,0 +1,30 @@
+// 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.android_webview.test;
+
+import android.app.Service;
+import android.os.Messenger;
+
+import java.io.Serializable;
+
+/**
+ * Class for running code in a separate Service.
+ * This class is Serializable so that it can't be passed through IPC from a test process to a
boliu 2016/09/15 04:57:53 "can't" or can?
gsennton 2016/09/15 10:02:04 Can :P
+ * service in a separate process.
+ */
+public abstract class ServiceTestRunner implements Serializable {
boliu 2016/09/15 04:57:53 interface?
+ /**
+ * Override this method to run code in a separate Service.
+ *
+ * OBS! Any child-classes of this class must be defined in the same apk where
+ * SeparateProcessWebViewService is defined - otherwise the Service won't be able to initiate an
+ * instance of that class.
+ *
+ * This method must send a message back to the test-code through the use of the Messenger
+ * testMessenger - the test will block indefinitely waiting for a message.
+ * service is a reference to the Service within which this code will be run.
+ */
+ public abstract void runTestOnMainThread(Messenger testMessenger, Service service);
+}

Powered by Google App Engine
This is Rietveld 408576698