1 // Copyright 2015 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 android.app.NativeActivity; 8 import android.os.Bundle; 9 10 /** 11 * A {@link android.app.NativeActivity} for running native unit tests. 12 * (i.e., not browser tests) 13 */ 14 public class NativeUnitTestNativeActivity extends NativeActivity { 15 private NativeUnitTest mTest = new NativeUnitTest(); 16 17 @Override onCreate(Bundle savedInstanceState)18 public void onCreate(Bundle savedInstanceState) { 19 mTest.preCreate(this); 20 super.onCreate(savedInstanceState); 21 mTest.postCreate(this); 22 } 23 24 @Override onStart()25 public void onStart() { 26 super.onStart(); 27 // Force running in sub thread, 28 // since NativeActivity processes Looper messages in native code, 29 // which makes invoking the test runner Handler problematic. 30 mTest.postStart(this, true); 31 } 32 } 33