Commit 46886050 authored by dpapad's avatar dpapad Committed by Chromium LUCI CQ

WebUI: Remove Mock4JS leftover callFunction() from test_api.js

Bug: 844820
Change-Id: I290d1c5b378d6243717304387722d16c3dd0644e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581811Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Auto-Submit: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835924}
parent ccb77145
......@@ -109,18 +109,6 @@ TEST_F('WebUIBrowserAsyncGenTest', 'TestContinue', function() {
// Test that runAllActionsAsync can be called with multiple functions, and with
// bound, saved, or mixed arguments.
TEST_F('WebUIBrowserAsyncGenTest', 'TestRunAllActionsAsync', function() {
// Bind some arguments.
var var1, var2;
function testBoundArgs() {
const action1 = callFunction(function(args) {
var1 = args[0];
}, ['val1']);
const action2 = callFunction(function(args) {
var2 = args[0];
}, ['val2']);
runAllActionsAsync(WhenTestDone.DEFAULT, action1, action2).invoke();
}
// Receive some saved arguments.
var var3, var4;
var savedArgs = new SaveMockArguments();
......@@ -153,7 +141,6 @@ TEST_F('WebUIBrowserAsyncGenTest', 'TestRunAllActionsAsync', function() {
// Send the cases to the mocked handler & tell the C++ handler to continue2.
window.continueTest = this.continueTest(WhenTestDone.ASSERT, function() {
testBoundArgs();
testSavedArgs(['passedVal1']);
testMixedArgs(['passedVal2']);
setTimeout(window.continueTest2, 0);
......@@ -161,8 +148,6 @@ TEST_F('WebUIBrowserAsyncGenTest', 'TestRunAllActionsAsync', function() {
// Check expectations after mocks have been called.
window.continueTest2 = this.continueTest(WhenTestDone.ALWAYS, function() {
expectEquals('val1', var1);
expectEquals('val2', var2);
expectEquals('passedVal1', var3);
expectEquals('passedVal1', var4);
expectEquals('passedVal2', var5);
......
......@@ -1051,17 +1051,6 @@ CallFunctionAction.prototype = {
}
};
/**
* Syntactic sugar for use with will() on a Mock4JS.Mock.
* @param {!Function} func The function to call when the method is invoked.
* @param {...*} var_args Arguments to pass when calling func.
* @return {CallFunctionAction} Action for use in will.
*/
function callFunction(func, var_args) {
return new CallFunctionAction(
null, null, func, Array.prototype.slice.call(arguments, 1));
}
/**
* Syntactic sugar for use with will() on a Mock4JS.Mock.
* @param {SaveMockArguments} savedArgs Arguments saved with this object
......@@ -1248,7 +1237,6 @@ function exportExpects() {
* Exports methods related to Mock4JS mocking.
*/
function exportMock4JsHelpers() {
exports.callFunction = callFunction;
exports.callFunctionWithSavedArgs = callFunctionWithSavedArgs;
exports.SaveMockArguments = SaveMockArguments;
}
......
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