| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content_browsertests_apk; | 5 package org.chromium.content_browsertests_apk; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 private static final String TAG = "ChromeBrowserTestsActivity"; | 27 private static final String TAG = "ChromeBrowserTestsActivity"; |
| 28 | 28 |
| 29 private ShellManager mShellManager; | 29 private ShellManager mShellManager; |
| 30 private WindowAndroid mWindowAndroid; | 30 private WindowAndroid mWindowAndroid; |
| 31 | 31 |
| 32 @Override | 32 @Override |
| 33 public void onCreate(Bundle savedInstanceState) { | 33 public void onCreate(Bundle savedInstanceState) { |
| 34 super.onCreate(savedInstanceState); | 34 super.onCreate(savedInstanceState); |
| 35 | 35 |
| 36 try { | 36 try { |
| 37 LibraryLoader.ensureInitialized(null); | 37 LibraryLoader.ensureInitialized(); |
| 38 } catch (ProcessInitException e) { | 38 } catch (ProcessInitException e) { |
| 39 Log.i(TAG, "Cannot load content_browsertests:" + e); | 39 Log.i(TAG, "Cannot load content_browsertests:" + e); |
| 40 System.exit(-1); | 40 System.exit(-1); |
| 41 } | 41 } |
| 42 BrowserStartupController.get(getApplicationContext()).initChromiumBrowse
rProcessForTests(); | 42 BrowserStartupController.get(getApplicationContext()).initChromiumBrowse
rProcessForTests(); |
| 43 | 43 |
| 44 LayoutInflater inflater = | 44 LayoutInflater inflater = |
| 45 (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVIC
E); | 45 (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVIC
E); |
| 46 View view = inflater.inflate(R.layout.test_activity, null); | 46 View view = inflater.inflate(R.layout.test_activity, null); |
| 47 mShellManager = (ShellManager) view.findViewById(R.id.shell_container); | 47 mShellManager = (ShellManager) view.findViewById(R.id.shell_container); |
| 48 mWindowAndroid = new ActivityWindowAndroid(this); | 48 mWindowAndroid = new ActivityWindowAndroid(this); |
| 49 mShellManager.setWindow(mWindowAndroid); | 49 mShellManager.setWindow(mWindowAndroid); |
| 50 | 50 |
| 51 Log.i(TAG, "Running tests"); | 51 Log.i(TAG, "Running tests"); |
| 52 runTests(); | 52 runTests(); |
| 53 Log.i(TAG, "Tests finished."); | 53 Log.i(TAG, "Tests finished."); |
| 54 finish(); | 54 finish(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 private void runTests() { | 57 private void runTests() { |
| 58 nativeRunTests(getFilesDir().getAbsolutePath(), getApplicationContext())
; | 58 nativeRunTests(getFilesDir().getAbsolutePath(), getApplicationContext())
; |
| 59 } | 59 } |
| 60 | 60 |
| 61 private native void nativeRunTests(String filesDir, Context appContext); | 61 private native void nativeRunTests(String filesDir, Context appContext); |
| 62 } | 62 } |
| OLD | NEW |