Skip to content

Commit

Permalink
Add an Android sample app for Telemetry tests.
Browse files Browse the repository at this point in the history
The purpose of this app is to be launched and push other apps to
the background during Android telemetry tests. It is just a
super simple Android app.

BUG=586148

Review URL: https://codereview.chromium.org/1744423002

Cr-Commit-Position: refs/heads/master@{#380680}
  • Loading branch information
case540 authored and Commit bot committed Mar 11, 2016
1 parent 74b49ea commit f5e9830
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 0 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ group("both_gn_and_gyp") {
"//third_party/smhasher:murmurhash3",
"//tools/android:android_tools",
"//tools/android:memconsumer",
"//tools/android:push_apps_to_background",
"//tools/android/heap_profiler:heap_profiler_unittests",
"//tools/android/kerberos/SpnegoAuthenticator:spnego_authenticator_apk",
"//tools/cygprofile:cygprofile_unittests",
Expand Down
1 change: 1 addition & 0 deletions build/all.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@
'../third_party/WebKit/public/all.gyp:*',
'../tools/android/android_tools.gyp:android_tools',
'../tools/android/android_tools.gyp:memconsumer',
'../tools/android/android_tools.gyp:push_apps_to_background',
'../tools/android/findbugs_plugin/findbugs_plugin.gyp:findbugs_plugin_test',
'../tools/cygprofile/cygprofile.gyp:cygprofile_unittests',
'../ui/android/ui_android.gyp:ui_android_unittests',
Expand Down
1 change: 1 addition & 0 deletions build/gn_migration.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
'../third_party/WebKit/Source/wtf/wtf_tests.gyp:wtf_unittests_apk',
'../tools/android/heap_profiler/heap_profiler.gyp:heap_profiler_unittests_apk',
'../tools/android/android_tools.gyp:memconsumer',
'../tools/android/android_tools.gyp:push_apps_to_background',
'../tools/imagediff/image_diff.gyp:image_diff#host',
'../third_party/catapult/telemetry/telemetry.gyp:bitmaptools#host',
'../ui/android/ui_android.gyp:ui_android_unittests_apk',
Expand Down
8 changes: 8 additions & 0 deletions tools/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ group("audio_focus_grabber") {
"//tools/android/audio_focus_grabber:audio_focus_grabber_apk",
]
}

# GYP: //tools/android/android_tools.gyp:push_apps_to_background
group("push_apps_to_background") {
testonly = true
deps = [
"//tools/android/push_apps_to_background:push_apps_to_background_apk",
]
}
8 changes: 8 additions & 0 deletions tools/android/android_tools.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,13 @@
'audio_focus_grabber/audio_focus_grabber.gyp:audio_focus_grabber_apk',
],
},
{
# GN: //tools/android:push_apps_to_background
'target_name': 'push_apps_to_background',
'type': 'none',
'dependencies': [
'push_apps_to_background/push_apps_to_background.gyp:push_apps_to_background_apk',
],
},
],
}
29 changes: 29 additions & 0 deletions tools/android/push_apps_to_background/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
* Copyright 2016 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.
-->

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.chromium.push_apps_to_background"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light" >
<activity
android:name="org.chromium.push_apps_to_background.PushAppsToBackgroundActivity"
android:label="@string/title_activity_push_apps_to_background"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
23 changes: 23 additions & 0 deletions tools/android/push_apps_to_background/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2016 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.

import("//build/config/android/rules.gni")
import("//testing/test.gni")

# Mark all targets as test only.
testonly = true

android_apk("push_apps_to_background_apk") {
apk_name = "PushAppsToBackground"
java_files = [ "src/org/chromium/push_apps_to_background/PushAppsToBackgroundActivity.java" ]
android_manifest = "AndroidManifest.xml"
deps = [
":push_apps_to_background_apk_resources",
]
}

android_resources("push_apps_to_background_apk_resources") {
resource_dirs = [ "res" ]
custom_package = "org.chromium.push_apps_to_background"
}
2 changes: 2 additions & 0 deletions tools/android/push_apps_to_background/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mikecase@chromium.org
perezju@chromium.org
21 changes: 21 additions & 0 deletions tools/android/push_apps_to_background/push_apps_to_background.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2016 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.
{
'targets': [
# GN: //tools/android/push_apps_to_background:push_apps_to_background_apk
{
'target_name': 'push_apps_to_background_apk',
'type': 'none',
'variables': {
'apk_name': 'PushAppsToBackground',
'java_in_dir': '.',
'resource_dir': 'res',
'android_manifest_path': 'AndroidManifest.xml',
},
'includes': [
'../../../build/java_apk.gypi',
],
},
],
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/push_apps_to_background_message" />
</LinearLayout>
15 changes: 15 additions & 0 deletions tools/android/push_apps_to_background/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 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.
-->

<resources>
<string name="app_name">Push Apps To Background</string>
<string name="push_apps_to_background_message">
"<b>What is my purpose?</b>\n
<i>You push apps to the background.</i>\n
<b>Oh my God</b>."
</string>
<string name="title_activity_push_apps_to_background">Push Apps To Background</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2016 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.push_apps_to_background;

import android.app.Activity;
import android.os.Bundle;

/**
* This activity is used in performance tests to push other apps
* to the background while running automated user stories.
*/
public class PushAppsToBackgroundActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_push_apps_to_background);
}
}

0 comments on commit f5e9830

Please sign in to comment.