Commit d31096d3 authored by mtomasz's avatar mtomasz Committed by Commit bot

Add a simple way of performing step by step tests for testers.

To debug tests, they need to be executed with the following switches:
--remote-debugging-port=9222
--enable-file-manager-step-by-step-tests
--enable-pixel-output-in-tests
--ui-test-action-timeout=10000000

Then run http://localhost:9222 in a separate browser window, then select
"chrome manager browser tests" and follow instructions.

TEST=Tested manually.
BUG=460813

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

Cr-Commit-Position: refs/heads/master@{#317559}
parent 25bd73e5
......@@ -36,6 +36,7 @@
"permissions": [
"fileSystem",
"tabs",
"commandLinePrivate",
"chrome-extension://oobinhbdbiehknkpbpejbbpdbkdjmoco/*",
"chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/*"
]
......
......@@ -6,5 +6,6 @@
"manifest_version": 2,
"web_accessible_resources": ["*"],
"background": {"scripts": ["gallery/background.js"]},
"incognito" : "split"
"incognito" : "split",
"permissions": ["commandLinePrivate"]
}
......@@ -14,6 +14,17 @@ function RemoteCall(extensionId) {
this.extensionId_ = extensionId;
}
/**
* Checks whether step by step tests are enabled or not.
* @return {Promise<bool>}
*/
RemoteCall.isStepByStepEnabled = function() {
return new Promise(function(fulfill) {
chrome.commandLinePrivate.hasSwitch(
'enable-file-manager-step-by-step-tests', fulfill);
});
};
/**
* Calls a remote test util in Files.app's extension. See: test_util.js.
*
......@@ -27,19 +38,37 @@ function RemoteCall(extensionId) {
*/
RemoteCall.prototype.callRemoteTestUtil =
function(func, appId, args, opt_callback) {
return new Promise(function(onFulfilled) {
chrome.runtime.sendMessage(
this.extensionId_,
{
func: func,
appId: appId,
args: args
},
function() {
if (opt_callback)
opt_callback.apply(null, arguments);
onFulfilled(arguments[0]);
});
return RemoteCall.isStepByStepEnabled().then(function(stepByStep) {
if (!stepByStep)
return false;
return new Promise(function(onFulfilled) {
console.info('Executing: ' + func + ' on ' + appId + ' with args: ');
console.info(args);
console.info('Type step() to continue...');
window.step = function() {
window.step = null;
onFulfilled(stepByStep);
};
});
}).then(function(stepByStep) {
return new Promise(function(onFulfilled) {
chrome.runtime.sendMessage(
this.extensionId_,
{
func: func,
appId: appId,
args: args
},
function(var_args) {
if (stepByStep) {
console.info('Returned value:');
console.info(arguments);
}
if (opt_callback)
opt_callback.apply(null, arguments);
onFulfilled(arguments[0]);
});
}.bind(this));
}.bind(this));
};
......
......@@ -12,5 +12,6 @@
"video_player/background.js",
"video_player/open_video_files.js"
]},
"incognito" : "split"
"incognito" : "split",
"permissions": ["commandLinePrivate"]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment