Script to create 6k worth of history…

nhirata

Originally I had this:#!/bin/bash
# website history generator v 0.01
#
# Usage webhistgen <n> <appname>
# n: number of websites to visit
# appname: application name such as org.mozilla.fennec

n=$1;
appname=$2;

cmdline=”adb shell am start -a android.intent.action.VIEW -n “$appname”/.App -d http://www.randomwebsite.com/cgi-bin/random.pl”;
closeApp=”adb shell ps| grep “$appname” | awk ‘{print $2}’ | xargs adb shell kill”

tPause=2;
tLaunch=30;
tShutdown=30;

cAppInt=8;

for ((a=1; a <= n ; a++))
do

echo $(date) $($cmdline);

#if it’s the first time launching a tab, wait longer, else wait a short time to open a new tab
if [ `expr $a % $cAppInt` == 1 ]
then
sleep $tLaunch;
else
sleep $tPause;
fi

#close the app every cAppInt tab open
if [ `expr $a % $cAppInt` == 0 ]
then
echo $(date) $($closeApp);
sleep $tShutdown;
fi
done

The problem is that:

1) the intent opens a new tab with the link

2) the quit command isn’t working unless the phone is rooted

Fennec doesn’t like 40 tabs being opened much less 6k worth of tabs open.

So… my only hope is probably Monkeyrunner…  Looking into that right now.

Update: So I caved into rooting; fixed my script … I’ll look at monkey runner later, need to finish verifying bugs.  You can find a copy of the bash script here : ( http://people.mozilla.com/~nhirata/Scripts/webhistgen.sh )

#!/bin/bash
# website history generator v 0.02
#
# Usage webhistgen <n> <appname>
# n: number of websites to visit
# appname: application name such as org.mozilla.fennec
#

n=$1;
appname=$2;

cmdLine=”adb shell am start -a android.intent.action.VIEW -n “$appname”/.App -d http://www.randomwebsite.com/cgi-bin/random.pl”;
listApps=”adb shell ps|grep “$appname” | cut -c11-15″;

tPause=2;
tLaunch=10;
tShutdown=10;
cAppInt=8;

for ((a=1; a <= n ; a++))
do
echo $(date) $($cmdLine);

#if it’s the first time launching a tab, wait longer, else wait a short time to open a new tab
if [ `expr $a % $cAppInt` == 1 ]
then
sleep $tLaunch;
else
sleep $tPause;
fi

#close the app every cAppInt tab open; kill each process for fennec
if [ `expr $a % $cAppInt` == 0 ]
then
for i in `$listApps`
do
echo $(date) “adb shell su -c kill -9 $i”;
echo `adb shell su -c “kill -9 “$i`;
done
sleep $tShutdown;
fi
done

Filed under: mobifx, mobile, QA, QMO