Index: content/public/test/android/javatests/src/org/chromium/content/browser/test/ChildProcessAllocatorSettingsHook.java |
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/ChildProcessAllocatorSettingsHook.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/ChildProcessAllocatorSettingsHook.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f27badd4ce6f930161eec392a5f0027df298bac6 |
--- /dev/null |
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/ChildProcessAllocatorSettingsHook.java |
@@ -0,0 +1,25 @@ |
+// Copyright 2017 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.content.browser.test; |
+ |
+import android.content.Context; |
+ |
+import org.chromium.base.test.BaseTestResult.PreTestHook; |
+import org.chromium.content.browser.ChildProcessLauncher; |
+ |
+import java.lang.reflect.Method; |
+ |
+/** PreTestHook used to register the ChildProcessAllocatorSettings annotation. */ |
+public final class ChildProcessAllocatorSettingsHook implements PreTestHook { |
+ @Override |
+ public void run(Context targetContext, Method testMethod) { |
+ ChildProcessAllocatorSettings annotation = |
+ testMethod.getAnnotation(ChildProcessAllocatorSettings.class); |
+ if (annotation != null) { |
+ ChildProcessLauncher.setSanboxServicesSettingsForTesting( |
+ annotation.sandboxedServiceCount(), annotation.sandboxedServiceName()); |
+ } |
+ } |
+} |