1 // Copyright 2018 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.base.test.task; 6 7 import org.jni_zero.NativeMethods; 8 9 /** Helpers that allow base::ThreadPoolInstance to be initialized or shutdown for testing. */ 10 public class ThreadPoolTestHelpers { 11 /** Initializes base::ThreadPoolInstance with default params. */ enableThreadPoolExecutionForTesting()12 public static void enableThreadPoolExecutionForTesting() { 13 ThreadPoolTestHelpersJni.get().enableThreadPoolExecutionForTesting(); 14 } 15 16 /** Shuts down base::ThreadPoolInstance. */ disableThreadPoolExecutionForTesting()17 public static void disableThreadPoolExecutionForTesting() { 18 ThreadPoolTestHelpersJni.get().disableThreadPoolExecutionForTesting(); 19 } 20 21 @NativeMethods 22 interface Natives { enableThreadPoolExecutionForTesting()23 void enableThreadPoolExecutionForTesting(); 24 disableThreadPoolExecutionForTesting()25 void disableThreadPoolExecutionForTesting(); 26 } 27 } 28