Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multistep measurement #151

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent/browser/chrome/compile.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rmdir /S /Q "%~dp0extension/release"
mkdir "%~dp0extension/release"
mkdir "%~dp0extension/release/wpt"
set CLOSURE_COMPILER_JAR="%~dp0/compiler.jar"
set COMPILE_JS=C:\Python_26\files\python.exe "%~dp0extension/third_party/closure-library/closure/bin/build/closurebuilder.py" ^
set COMPILE_JS=python.exe "%~dp0extension/third_party/closure-library/closure/bin/build/closurebuilder.py" ^
--root="%~dp0extension/third_party/closure-library/" ^
--root="%~dp0extension/wpt" ^
--compiler_jar=%CLOSURE_COMPILER_JAR% ^
Expand All @@ -25,4 +25,5 @@ copy "%~dp0extension\manifest.json" "%~dp0extension\release\manifest.json"
copy "%~dp0extension\wpt\*.html" "%~dp0extension\release\wpt\"
copy "%~dp0extension\wpt\*.jpg" "%~dp0extension\release\wpt\"
copy "%~dp0extension\wpt\*.css" "%~dp0extension\release\wpt\"
xcopy /e /v /y "%~dp0extension\release\*" "%~dp0extension\..\..\..\..\Debug\extension\"
pause
4 changes: 2 additions & 2 deletions agent/browser/chrome/extension/release/wpt/allTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18179,9 +18179,9 @@ wpt.commands.CommandRunner.prototype.doSetDOMElements = function() {
if (goog.isNull(g_tabid))
throw ('It should not be posible to run the doSetDOMElements() method ' +
'before we find the id of the tab in which pages are loaded.');

chrome.tabs.sendRequest(
g_tabid,
g_tabid,
{'message': 'setDOMElements', name_values: wpt.commands.g_domElements},
function(response) {});
wpt.LOG.info('doSetDOMElements for : ' + wpt.commands.g_domElements);
Expand Down
17 changes: 15 additions & 2 deletions agent/browser/chrome/extension/release/wpt/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -13830,9 +13830,9 @@ wpt.commands.CommandRunner.prototype.doSetDOMElements = function() {
if (goog.isNull(g_tabid))
throw ('It should not be posible to run the doSetDOMElements() method ' +
'before we find the id of the tab in which pages are loaded.');

chrome.tabs.sendRequest(
g_tabid,
g_tabid,
{'message': 'setDOMElements', name_values: wpt.commands.g_domElements},
function(response) {});
wpt.LOG.info('doSetDOMElements for : ' + wpt.commands.g_domElements);
Expand Down Expand Up @@ -14718,6 +14718,10 @@ var wptTaskCallback = function() {
window.setTimeout(wptGetTask, TASK_INTERVAL_SHORT);
}

// Boolean if a navigation command occured
// (needed to reset expected dom elements for setDOMElement command)
var g_navigationCmd = false;

// execute a single task/script command
function wptExecuteTask(task) {
if (task.action.length) {
Expand All @@ -14735,10 +14739,12 @@ function wptExecuteTask(task) {
case 'navigate':
g_processing_task = true;
g_commandRunner.doNavigate(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'exec':
g_processing_task = true;
g_commandRunner.doExec(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'setcookie':
g_commandRunner.doSetCookie(task.target, task.value);
Expand All @@ -14747,6 +14753,11 @@ function wptExecuteTask(task) {
g_commandRunner.doBlock(task.target);
break;
case 'setdomelement':
// Reset dom elements if navigation command occured before
if(g_navigationCmd){
wpt.commands.g_domElements = [];
g_navigationCmd = false;
}
// Sending request to set the DOM element has to happen only at the
// navigate event after the content script is loaded. So, this just
// sets the global variable.
Expand All @@ -14755,6 +14766,7 @@ function wptExecuteTask(task) {
case 'click':
g_processing_task = true;
g_commandRunner.doClick(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'setinnerhtml':
g_processing_task = true;
Expand All @@ -14771,6 +14783,7 @@ function wptExecuteTask(task) {
case 'submitform':
g_processing_task = true;
g_commandRunner.doSubmitForm(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'clearcache':
g_processing_task = true;
Expand Down
13 changes: 13 additions & 0 deletions agent/browser/chrome/extension/wpt/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ var wptTaskCallback = function() {
window.setTimeout(wptGetTask, TASK_INTERVAL_SHORT);
}

// Boolean if a navigation command occured
// (needed to reset expected dom elements for setDOMElement command)
var g_navigationCmd = false;

// execute a single task/script command
function wptExecuteTask(task) {
if (task.action.length) {
Expand All @@ -422,10 +426,12 @@ function wptExecuteTask(task) {
case 'navigate':
g_processing_task = true;
g_commandRunner.doNavigate(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'exec':
g_processing_task = true;
g_commandRunner.doExec(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'setcookie':
g_commandRunner.doSetCookie(task.target, task.value);
Expand All @@ -434,6 +440,11 @@ function wptExecuteTask(task) {
g_commandRunner.doBlock(task.target);
break;
case 'setdomelement':
// Reset dom elements if navigation command occured before
if(g_navigationCmd){
wpt.commands.g_domElements = [];
g_navigationCmd = false;
}
// Sending request to set the DOM element has to happen only at the
// navigate event after the content script is loaded. So, this just
// sets the global variable.
Expand All @@ -442,6 +453,7 @@ function wptExecuteTask(task) {
case 'click':
g_processing_task = true;
g_commandRunner.doClick(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'setinnerhtml':
g_processing_task = true;
Expand All @@ -458,6 +470,7 @@ function wptExecuteTask(task) {
case 'submitform':
g_processing_task = true;
g_commandRunner.doSubmitForm(task.target, wptTaskCallback);
g_navigationCmd = true;
break;
case 'clearcache':
g_processing_task = true;
Expand Down
4 changes: 2 additions & 2 deletions agent/browser/chrome/extension/wpt/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ wpt.commands.CommandRunner.prototype.doSetDOMElements = function() {
if (goog.isNull(g_tabid))
throw ('It should not be posible to run the doSetDOMElements() method ' +
'before we find the id of the tab in which pages are loaded.');

chrome.tabs.sendRequest(
g_tabid,
g_tabid,
{'message': 'setDOMElements', name_values: wpt.commands.g_domElements},
function(response) {});
wpt.LOG.info('doSetDOMElements for : ' + wpt.commands.g_domElements);
Expand Down
8 changes: 6 additions & 2 deletions agent/browser/firefox/extension/chrome/content/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ wpt.moz.main.setDomElement = function(target) {

wpt.moz.main.pollForDomElements = function() {
var missingDomElements = [];
for (var i = 0, ie = wpt.moz.main.domElementsToWaitOn_.length; i < ie; i++) {
var target = wpt.moz.main.domElementsToWaitOn_[i];
for (var i = 0; i < wpt.moz.main.domElementsToWaitOn_.length; i++) {
var target = wpt.moz.main.domElementsToWaitOn_[i];
var targetInPage = SendCommandToContentScript_({
'command': 'isTargetInDom',
'target': target
Expand All @@ -522,7 +522,11 @@ wpt.moz.main.pollForDomElements = function() {
var domElementParams = {
'name_value': target
};

wpt.moz.main.sendEventToDriver_('dom_element', domElementParams);
var index = wpt.moz.main.domElementsToWaitOn_.indexOf(target)
wpt.moz.main.domElementsToWaitOn_.splice(index, 1);;
i--;
} else {
// If we did not find |target|, save it for the next poll.
missingDomElements.push(target);
Expand Down
4 changes: 4 additions & 0 deletions agent/wptdriver/web_browser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ bool WebBrowser::RunAndWait(bool &critical_error) {
WaitForSingleObject(additional_process, 120000);
CloseHandle(additional_process);
}
// Execute browser cleanup batch file
if(_browser._cleanupBatch && _browser._cleanupBatch.GetLength() > 0){
system(CT2A(_browser._cleanupBatch));
}
LeaveCriticalSection(&cs);
ResetIpfw();
RemoveGlobalHook();
Expand Down
6 changes: 6 additions & 0 deletions agent/wptdriver/wpt_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ bool BrowserSettings::Load(const TCHAR * browser, const TCHAR * iniFile,
_exe.Empty();
_exe_directory.Empty();
_options.Empty();
_cleanupBatch.Empty();

AtlTrace(_T("Loading settings for %s"), (LPCTSTR)browser);

Expand Down Expand Up @@ -314,6 +315,11 @@ bool BrowserSettings::Load(const TCHAR * browser, const TCHAR * iniFile,
ret = true;
}

if (GetPrivateProfileString(browser, _T("cleanup-batch"), _T(""), buff,
_countof(buff), iniFile )) {
_cleanupBatch = buff;
}

if (GetPrivateProfileString(browser, _T("options"), _T(""), buff,
_countof(buff), iniFile )) {
_options = buff;
Expand Down
1 change: 1 addition & 0 deletions agent/wptdriver/wpt_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class BrowserSettings {
CString _exe_directory;
CString _profile_directory;
CString _cache_directory;
CString _cleanupBatch;

// Windows/IE directories
CString windows_dir_;
Expand Down
26 changes: 25 additions & 1 deletion agent/wptdriver/wpt_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,11 @@ bool WptTest::ProcessCommand(ScriptCommand& command, bool &consumed) {
_block_requests.AddTail(command.target);
continue_processing = false;
consumed = false;
} else if (cmd == _T("seteventname")) {
event_name = command.target;
convertForHTML(event_name);
WptTrace(loglevel::kFrequentEvent,
_T("[wpthook] - WptTest - received SetEventName-command: "+command.target));
} else if (cmd == _T("setdomelement")) {
if (command.target.Trim().GetLength()) {
_dom_element_check = true;
Expand All @@ -681,7 +686,7 @@ bool WptTest::ProcessCommand(ScriptCommand& command, bool &consumed) {
continue_processing = false;
consumed = false;
}

return continue_processing;
}

Expand Down Expand Up @@ -1007,3 +1012,22 @@ void WptTest::Unlock() {
bool WptTest::IsLocked() {
return lock_count_ != 0;
}

void WptTest::convertForHTML(CString& text){
text.Replace(_T("ä"), _T("ae"));
text.Replace(_T("ö"), _T("oe"));
text.Replace(_T("ü"), _T("ue"));
text.Replace(_T("Ä"), _T("Ae"));
text.Replace(_T("Ö"), _T("Oe"));
text.Replace(_T("Ü"), _T("Ue"));
text.Replace(_T("ß"), _T("ss"));

// Can't be used since WPT-Server-Code isn't capable to handle it
// text.Replace(_T("ä"), _T("&auml;"));
// text.Replace(_T("ö"), _T("&ouml;"));
// text.Replace(_T("ü"), _T("&uuml;"));
// text.Replace(_T("Ä"), _T("&Auml;"));
// text.Replace(_T("Ö"), _T("&Ouml;"));
// text.Replace(_T("Ü"), _T("&Uuml;"));
// text.Replace(_T("ß"), _T("&szlig;"));
}
5 changes: 5 additions & 0 deletions agent/wptdriver/wpt_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ class WptTest {
// Whether we need to wait for DOM element.
bool _dom_element_check;
int _no_run; // conditional block support - if/else/endif
// for seteventname command
CString event_name;

// system information
bool has_gpu_;
Expand Down Expand Up @@ -241,4 +243,7 @@ class WptTest {
CAtlList<HttpHeaderValue> _override_hosts;

CAtlMap<USHORT, USHORT> _tcp_port_override;

private:
void convertForHTML(CString& text);
};
7 changes: 7 additions & 0 deletions agent/wpthook/request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ Request::~Request(void) {
DeleteCriticalSection(&cs);
}

CStringA Request::GetEventName(void){
return CT2A(event_name);
}

void Request::SetEventName(CString eventName){
event_name = eventName;
}
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
void Request::DataIn(DataChunk& chunk) {
Expand Down
4 changes: 4 additions & 0 deletions agent/wpthook/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,17 @@ class Request {
ULONG GetPeerAddress();
CString GetUrl();

CStringA GetEventName();
void SetEventName(CString eventName);
bool _processed;
bool _reported;
DWORD _socket_id;
ULONG _peer_address;
int _local_port;
bool _is_ssl;
bool _is_spdy;

CString event_name;
CString initiator_;
CString initiator_line_;
CString initiator_column_;
Expand Down
Loading