зеркало из https://github.com/openwpm/OpenWPM.git
Merge branch 'custom_ff_bin_terminal_colors' of https://github.com/gunesacar/OpenWPM into gunesacar-custom_ff_bin_terminal_colors
This commit is contained in:
Коммит
9bb9b2e570
|
@ -57,10 +57,12 @@ exports.executeSQL = function(statement, async) {
|
|||
// send to console if debugging
|
||||
// TODO remove async argument
|
||||
if (debugging) {
|
||||
if (typeof statement == 'string')
|
||||
if (typeof statement == 'string'){
|
||||
console.log("SQLite",statement);
|
||||
else
|
||||
console.log("SQLite",statement[1]);
|
||||
}else{ // log the table name and values to be inserted
|
||||
var table_name = statement[0].replace("INSERT INTO ", "").split(" ")[0];
|
||||
console.log("SQLite", table_name, statement[1]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// catch statements without arguments
|
||||
|
|
Двоичные данные
automation/Extension/firefox/openwpm.xpi
Двоичные данные
automation/Extension/firefox/openwpm.xpi
Двоичный файл не отображается.
|
@ -1,6 +1,10 @@
|
|||
from utilities import BASE_TEST_URL, start_server
|
||||
from os.path import dirname, join, realpath
|
||||
import subprocess
|
||||
|
||||
OPENWPM_LOG_PREFIX = "console.log: openwpm: "
|
||||
INSERT_PREFIX = "Array"
|
||||
|
||||
|
||||
class bcolors:
|
||||
HEADER = '\033[95m'
|
||||
|
@ -13,20 +17,30 @@ class bcolors:
|
|||
UNDERLINE = '\033[4m'
|
||||
|
||||
|
||||
def run_cmd(command):
|
||||
def get_command_output(command, cwd=None):
|
||||
popen = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, cwd=cwd)
|
||||
return iter(popen.stdout.readline, b"")
|
||||
|
||||
def colorize(line):
|
||||
if INSERT_PREFIX in line: # print long DB insert lines in blue
|
||||
line = line.replace(INSERT_PREFIX, bcolors.OKBLUE + INSERT_PREFIX)
|
||||
if OPENWPM_LOG_PREFIX in line:
|
||||
line = line.replace(OPENWPM_LOG_PREFIX,
|
||||
OPENWPM_LOG_PREFIX + bcolors.OKGREEN)
|
||||
return line
|
||||
|
||||
def start_manual_test():
|
||||
cmd_cd = "cd ../automation/Extension/firefox/"
|
||||
cmd_jpm = "jpm run --binary-args '%s' -b `which firefox`" % BASE_TEST_URL
|
||||
base_dir = dirname(dirname(realpath(__file__)))
|
||||
ext_path = join(base_dir, 'automation', 'Extension', 'firefox')
|
||||
ff_bin_path = join(base_dir, 'firefox-bin', 'firefox')
|
||||
cmd_jpm_run = "jpm run --binary-args 'url %s' -b %s" % (BASE_TEST_URL,
|
||||
ff_bin_path)
|
||||
server, thread = start_server()
|
||||
try:
|
||||
# http://stackoverflow.com/a/4417735/3104416
|
||||
for line in run_cmd("%s && %s" % (cmd_cd, cmd_jpm)):
|
||||
print bcolors.OKGREEN, line, bcolors.ENDC,
|
||||
for line in get_command_output(cmd_jpm_run, cwd=ext_path):
|
||||
print colorize(line), bcolors.ENDC,
|
||||
except KeyboardInterrupt:
|
||||
print "Keyboard Interrupt detected, shutting down..."
|
||||
print "\nClosing server thread..."
|
||||
|
|
|
@ -7,6 +7,7 @@ import plyvel
|
|||
import os
|
||||
import sqlite3
|
||||
from random import choice
|
||||
from os.path import realpath, dirname
|
||||
LOCAL_WEBSERVER_PORT = 8000
|
||||
PSL_CACHE_LOC = '/tmp/public_suffix_list.dat'
|
||||
BASE_TEST_URL_DOMAIN = "localtest.me"
|
||||
|
@ -27,6 +28,8 @@ def start_server():
|
|||
`http://localtest.me:8000/test_pages/...`
|
||||
"""
|
||||
print "Starting HTTP Server in a separate thread"
|
||||
# switch to test dir, this is where the test files are
|
||||
os.chdir(dirname(realpath(__file__)))
|
||||
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
|
||||
server = MyTCPServer(("localhost", LOCAL_WEBSERVER_PORT), Handler)
|
||||
thread = threading.Thread(target=server.serve_forever)
|
||||
|
|
Загрузка…
Ссылка в новой задаче