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

Side by Side Diff: base/test/android/java/org/chromium/ChromeNativeTestActivity.java

Issue 9834037: apk-based test runner work. Not enabled yet. This CL is a combination of upstreaming, ndk/ant-ifi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more line tweak Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
Satish 2012/03/27 13:53:24 could change year to 2012
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;
Satish 2012/03/27 13:53:24 should this file be under a 'org/chromium/native_t
klobag.chromium 2012/03/28 00:28:57 For future proof where we may add resources, we sh
6
7 import android.app.Activity;
8 import android.os.Bundle;
9 import android.util.Log;
10
11 // Android's NativeActivity is mostly useful for pure-native code.
12 // Our tests need to go up to our own java classes, which is not possible using
13 // the native activity class loader.
14 // We start a background thread in here to run the tests and avoid an ANR.
15 // TODO(bulach): watch out for tests that implicitly assume they run on the main
16 // thread.
17 public class ChromeNativeTestActivity extends Activity {
18 private final String TAG = "ChromeNativeTestActivity";
19 private final String LIBRARY = "native_tests";
20
21 @Override
22 public void onCreate(Bundle savedInstanceState) {
23 super.onCreate(savedInstanceState);
24 try {
25 loadLibrary();
26 new Thread() {
27 @Override
28 public void run() {
29 Log.d(TAG, ">>nativeRunTests");
30 nativeRunTests(getFilesDir().getAbsolutePath());
31 Log.d(TAG, "<<nativeRunTests");
32 }
33 }.start();
34 } catch (UnsatisfiedLinkError e) {
35 Log.e(TAG, "Unable to load libnative_tests.so: " + e);
36 throw e;
37 }
38 }
39
40 private void loadLibrary() throws UnsatisfiedLinkError {
41 Log.i(TAG, "loading: " + LIBRARY);
42 System.loadLibrary(LIBRARY);
43 Log.i(TAG, "loaded: " + LIBRARY);
44 }
45
46 private native void nativeRunTests(String filesDir);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698