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 3// found in the LICENSE file. 4 5package org.chromium.android_webview.shell; 6 7import android.app.Application; 8import android.os.Debug; 9import android.util.Log; 10 11import org.chromium.android_webview.AwBrowserProcess; 12import org.chromium.base.BaseSwitches; 13import org.chromium.base.CommandLine; 14import org.chromium.base.ResourceExtractor; 15import org.chromium.base.TraceEvent; 16 17/** 18 * The android_webview shell Application subclass. 19 */ 20public class AwShellApplication extends Application { 21 22 private static final String TAG = "AwShellApplication"; 23 /** The minimum set of .pak files the test runner needs. */ 24 private static final String[] MANDATORY_PAKS = { "icudtl.dat" }; 25 26 @Override 27 public void onCreate() { 28 super.onCreate(); 29 30 AwShellResourceProvider.registerResources(this); 31 32 CommandLine.initFromFile("/data/local/tmp/android-webview-command-line"); 33 34 if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) { 35 Log.e(TAG, "Waiting for Java debugger to connect..."); 36 Debug.waitForDebugger(); 37 Log.e(TAG, "Java debugger connected. Resuming execution."); 38 } 39 40 ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAKS); 41 ResourceExtractor.setExtractImplicitLocaleForTesting(false); 42 AwBrowserProcess.loadLibrary(); 43 44 if (CommandLine.getInstance().hasSwitch(AwShellSwitches.ENABLE_ATRACE)) { 45 Log.e(TAG, "Enabling Android trace."); 46 TraceEvent.setATraceEnabled(true); 47 } 48 } 49} 50