• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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.native_test;
6 
7 import org.jni_zero.JNINamespace;
8 import org.jni_zero.NativeMethods;
9 
10 /**
11  * This class provides a way to run the native main method.
12  * It is used in the multi-process test case, so that the child process can call
13  * the main method without //base/test:test_support's linkage requiring the
14  * main() symbol.
15  */
16 @JNINamespace("testing::android")
17 public final class MainRunner {
18     // Prevents instantiation.
MainRunner()19     private MainRunner() {}
20 
21     // Maps the file descriptors and executes the main method with the passed in command line.
runMain(String[] commandLine)22     public static int runMain(String[] commandLine) {
23         return MainRunnerJni.get().runMain(commandLine);
24     }
25 
26     @NativeMethods
27     interface Natives {
runMain(String[] commandLine)28         int runMain(String[] commandLine);
29     }
30 }
31