From ef4612c97e2dd450fa05b7a75683ec79b3f467d3 Mon Sep 17 00:00:00 2001 From: "mkosiba@chromium.org" Date: Thu, 1 May 2014 17:01:15 +0000 Subject: [android_webview] Make it possible to enable trace for the shell. In r265466 we moved initTraceEvent to the glue layer. This makes it impossible to trace from the test shell. BUG=None Review URL: https://codereview.chromium.org/265833005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267546 0039d316-1c4b-4281-b951-d872f2087c98 --- .../android_webview/shell/AwShellApplication.java | 9 +++++++++ .../android_webview/shell/AwShellSwitches.java | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellSwitches.java diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java index f6488f4..b019d8a 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java @@ -11,8 +11,12 @@ import android.util.Log; import org.chromium.android_webview.AwBrowserProcess; import org.chromium.base.BaseSwitches; import org.chromium.base.CommandLine; +import org.chromium.base.TraceEvent; import org.chromium.content.browser.ResourceExtractor; +/** + * The android_webview shell Application subclass. + */ public class AwShellApplication extends Application { private static final String TAG = "AwShellApplication"; @@ -38,5 +42,10 @@ public class AwShellApplication extends Application { ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAKS); ResourceExtractor.setExtractImplicitLocaleForTesting(false); AwBrowserProcess.loadLibrary(); + + if (CommandLine.getInstance().hasSwitch(AwShellSwitches.ENABLE_ATRACE)) { + Log.e(TAG, "Enabling Android trace."); + TraceEvent.setATraceEnabled(true); + } } } diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellSwitches.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellSwitches.java new file mode 100644 index 0000000..2aceb92 --- /dev/null +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellSwitches.java @@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.android_webview.shell; + +/** + * Contains all of the command line switches that are specific to the test shell of + * the android_webview glue layer. + */ +public abstract class AwShellSwitches { + // Enables Android systrace path for Chrome traces. + public static final String ENABLE_ATRACE = "enable-atrace"; + + // Prevent instantiation. + private AwShellSwitches() {} +} + -- cgit v1.1