From 6cbdd03533077e3b99d14a375151d741c7883136 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Tue, 10 Aug 2021 21:34:23 +0000 Subject: [PATCH] Bug 1713442 - [remote] Rename all messagehandler test modules to follow the correct naming pattern r=webdriver-reviewers,whimboo Depends on D120640 Differential Revision: https://phabricator.services.mozilla.com/D122224 --- .../broadcast/browser_only_content_process.js | 2 +- .../test/browser/broadcast/browser_two_tabs.js | 2 +- .../broadcast/browser_two_tabs_with_params.js | 2 +- .../browser/broadcast/browser_two_windows.js | 2 +- .../browser/broadcast/browser_with_frames.js | 2 +- .../browser/browser_handle_command_errors.js | 4 ++-- .../browser/browser_handle_simple_command.js | 18 +++++++++--------- .../root/{TestModule.jsm => command.jsm} | 6 ++++-- .../{TestModule.jsm => command.jsm} | 8 +++++--- .../{TestModule.jsm => command.jsm} | 6 ++++-- ...lModule.jsm => commandwindowglobalonly.jsm} | 6 ++++-- 11 files changed, 33 insertions(+), 25 deletions(-) rename remote/shared/messagehandler/test/browser/resources/modules/root/{TestModule.jsm => command.jsm} (83%) rename remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/{TestModule.jsm => command.jsm} (86%) rename remote/shared/messagehandler/test/browser/resources/modules/windowglobal/{TestModule.jsm => command.jsm} (88%) rename remote/shared/messagehandler/test/browser/resources/modules/windowglobal/{TestOnlyInWindowGlobalModule.jsm => commandwindowglobalonly.jsm} (82%) diff --git a/remote/shared/messagehandler/test/browser/broadcast/browser_only_content_process.js b/remote/shared/messagehandler/test/browser/broadcast/browser_only_content_process.js index 15595f5453af..89f00976c3bc 100644 --- a/remote/shared/messagehandler/test/browser/broadcast/browser_only_content_process.js +++ b/remote/shared/messagehandler/test/browser/broadcast/browser_only_content_process.js @@ -24,7 +24,7 @@ add_task(async function test_broadcasting_only_content_process() { "session-id-broadcasting_only_content_process" ); const broadcastValue = await sendTestBroadcastCommand( - "TestOnlyInWindowGlobalModule", + "commandwindowglobalonly", "testBroadcast", {}, rootMessageHandler diff --git a/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs.js b/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs.js index d3ac2671dbf5..b19d84a143c3 100644 --- a/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs.js +++ b/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs.js @@ -20,7 +20,7 @@ add_task(async function test_broadcasting_two_tabs_command() { ); const broadcastValue = await sendTestBroadcastCommand( - "TestOnlyInWindowGlobalModule", + "commandwindowglobalonly", "testBroadcast", {}, rootMessageHandler diff --git a/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs_with_params.js b/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs_with_params.js index 1edd5d93a81b..97cfc827c2b8 100644 --- a/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs_with_params.js +++ b/remote/shared/messagehandler/test/browser/broadcast/browser_two_tabs_with_params.js @@ -20,7 +20,7 @@ add_task(async function test_broadcasting_two_tabs_with_params_command() { ); const broadcastValue = await sendTestBroadcastCommand( - "TestOnlyInWindowGlobalModule", + "commandwindowglobalonly", "testBroadcastWithParameter", { value: "some-value", diff --git a/remote/shared/messagehandler/test/browser/broadcast/browser_two_windows.js b/remote/shared/messagehandler/test/browser/broadcast/browser_two_windows.js index 3797548695c1..dbf052108769 100644 --- a/remote/shared/messagehandler/test/browser/broadcast/browser_two_windows.js +++ b/remote/shared/messagehandler/test/browser/broadcast/browser_two_windows.js @@ -21,7 +21,7 @@ add_task(async function test_broadcasting_two_windows_command() { "session-id-broadcasting_two_windows_command" ); const broadcastValue = await sendTestBroadcastCommand( - "TestOnlyInWindowGlobalModule", + "commandwindowglobalonly", "testBroadcast", {}, rootMessageHandler diff --git a/remote/shared/messagehandler/test/browser/broadcast/browser_with_frames.js b/remote/shared/messagehandler/test/browser/broadcast/browser_with_frames.js index 841bb412735d..ece3995fcce2 100644 --- a/remote/shared/messagehandler/test/browser/broadcast/browser_with_frames.js +++ b/remote/shared/messagehandler/test/browser/broadcast/browser_with_frames.js @@ -15,7 +15,7 @@ add_task(async function test_broadcasting_with_frames() { "session-id-broadcasting_with_frames" ); const broadcastValue = await sendTestBroadcastCommand( - "TestOnlyInWindowGlobalModule", + "commandwindowglobalonly", "testBroadcast", {}, rootMessageHandler diff --git a/remote/shared/messagehandler/test/browser/browser_handle_command_errors.js b/remote/shared/messagehandler/test/browser/browser_handle_command_errors.js index f092984f026a..4ae6a04e9117 100644 --- a/remote/shared/messagehandler/test/browser/browser_handle_command_errors.js +++ b/remote/shared/messagehandler/test/browser/browser_handle_command_errors.js @@ -17,7 +17,7 @@ add_task(async function test_module_error() { info("Call a module method which will throw"); try { await rootMessageHandler.handleCommand({ - moduleName: "TestOnlyInWindowGlobalModule", + moduleName: "commandwindowglobalonly", commandName: "testError", destination: { type: WindowGlobalMessageHandler.type, @@ -45,7 +45,7 @@ add_task(async function test_destination_error() { "No browsing context matches fakeBrowsingContextId" ); await rootMessageHandler.handleCommand({ - moduleName: "TestOnlyInWindowGlobalModule", + moduleName: "commandwindowglobalonly", commandName: "testOnlyInWindowGlobal", destination: { type: WindowGlobalMessageHandler.type, diff --git a/remote/shared/messagehandler/test/browser/browser_handle_simple_command.js b/remote/shared/messagehandler/test/browser/browser_handle_simple_command.js index 1dad08031ba1..9aa04924dc5b 100644 --- a/remote/shared/messagehandler/test/browser/browser_handle_simple_command.js +++ b/remote/shared/messagehandler/test/browser/browser_handle_simple_command.js @@ -14,7 +14,7 @@ const { WindowGlobalMessageHandler } = ChromeUtils.import( add_task(async function test_rootModule_command() { const rootMessageHandler = createRootMessageHandler("session-id-rootModule"); const rootValue = await rootMessageHandler.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testRootModule", destination: { type: RootMessageHandler.type, @@ -39,7 +39,7 @@ add_task(async function test_windowglobalInRootModule_command() { "session-id-windowglobalInRootModule" ); const interceptedValue = await rootMessageHandler.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testInterceptModule", destination: { type: WindowGlobalMessageHandler.type, @@ -65,7 +65,7 @@ add_task(async function test_windowglobalModule_command() { "session-id-windowglobalModule" ); const windowGlobalValue = await rootMessageHandler.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testWindowGlobalModule", destination: { type: WindowGlobalMessageHandler.type, @@ -92,7 +92,7 @@ add_task(async function test_windowglobalOnlyModule_command() { "session-id-windowglobalOnlyModule" ); const windowGlobalOnlyValue = await rootMessageHandler.handleCommand({ - moduleName: "TestOnlyInWindowGlobalModule", + moduleName: "commandwindowglobalonly", commandName: "testOnlyInWindowGlobal", destination: { type: WindowGlobalMessageHandler.type, @@ -125,7 +125,7 @@ add_task(async function test_multisession() { info("Set value for session 1"); await rootMessageHandler1.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testSetValue", destination: { type: WindowGlobalMessageHandler.type, @@ -136,7 +136,7 @@ add_task(async function test_multisession() { info("Set value for session 2"); await rootMessageHandler2.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testSetValue", destination: { type: WindowGlobalMessageHandler.type, @@ -146,7 +146,7 @@ add_task(async function test_multisession() { }); const session1Value = await rootMessageHandler1.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testGetValue", destination: { type: WindowGlobalMessageHandler.type, @@ -161,7 +161,7 @@ add_task(async function test_multisession() { ); const session2Value = await rootMessageHandler2.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testGetValue", destination: { type: WindowGlobalMessageHandler.type, @@ -187,7 +187,7 @@ add_task(async function test_forwarding_command() { const rootMessageHandler = createRootMessageHandler("session-id-forwarding"); const interceptAndForwardValue = await rootMessageHandler.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testInterceptAndForwardModule", destination: { type: WindowGlobalMessageHandler.type, diff --git a/remote/shared/messagehandler/test/browser/resources/modules/root/TestModule.jsm b/remote/shared/messagehandler/test/browser/resources/modules/root/command.jsm similarity index 83% rename from remote/shared/messagehandler/test/browser/resources/modules/root/TestModule.jsm rename to remote/shared/messagehandler/test/browser/resources/modules/root/command.jsm index 8fff143d72de..1ce9082f823f 100644 --- a/remote/shared/messagehandler/test/browser/resources/modules/root/TestModule.jsm +++ b/remote/shared/messagehandler/test/browser/resources/modules/root/command.jsm @@ -4,9 +4,9 @@ "use strict"; -const EXPORTED_SYMBOLS = ["TestModule"]; +const EXPORTED_SYMBOLS = ["command"]; -class TestModule { +class Command { constructor(messageHandler) { this.messageHandler = messageHandler; } @@ -21,3 +21,5 @@ class TestModule { return "root-value"; } } + +const command = Command; diff --git a/remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/TestModule.jsm b/remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/command.jsm similarity index 86% rename from remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/TestModule.jsm rename to remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/command.jsm index 149bbb58e6bb..4f9e1cc2923f 100644 --- a/remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/TestModule.jsm +++ b/remote/shared/messagehandler/test/browser/resources/modules/windowglobal-in-root/command.jsm @@ -4,9 +4,9 @@ "use strict"; -const EXPORTED_SYMBOLS = ["TestModule"]; +const EXPORTED_SYMBOLS = ["command"]; -class TestModule { +class Command { constructor(messageHandler) { this.messageHandler = messageHandler; } @@ -23,10 +23,12 @@ class TestModule { async testInterceptAndForwardModule(params, destination) { const windowGlobalValue = await this.messageHandler.handleCommand({ - moduleName: "TestModule", + moduleName: "command", commandName: "testForwardToWindowGlobal", destination, }); return "intercepted-and-forward+" + windowGlobalValue; } } + +const command = Command; diff --git a/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/TestModule.jsm b/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/command.jsm similarity index 88% rename from remote/shared/messagehandler/test/browser/resources/modules/windowglobal/TestModule.jsm rename to remote/shared/messagehandler/test/browser/resources/modules/windowglobal/command.jsm index f4dceaa2208b..9732aaa57f26 100644 --- a/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/TestModule.jsm +++ b/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/command.jsm @@ -4,9 +4,9 @@ "use strict"; -const EXPORTED_SYMBOLS = ["TestModule"]; +const EXPORTED_SYMBOLS = ["command"]; -class TestModule { +class Command { constructor(messageHandler) { this.messageHandler = messageHandler; } @@ -33,3 +33,5 @@ class TestModule { return "forward-to-windowglobal-value"; } } + +const command = Command; diff --git a/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/TestOnlyInWindowGlobalModule.jsm b/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/commandwindowglobalonly.jsm similarity index 82% rename from remote/shared/messagehandler/test/browser/resources/modules/windowglobal/TestOnlyInWindowGlobalModule.jsm rename to remote/shared/messagehandler/test/browser/resources/modules/windowglobal/commandwindowglobalonly.jsm index fe58722d57e1..a5430edfb9f3 100644 --- a/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/TestOnlyInWindowGlobalModule.jsm +++ b/remote/shared/messagehandler/test/browser/resources/modules/windowglobal/commandwindowglobalonly.jsm @@ -4,9 +4,9 @@ "use strict"; -const EXPORTED_SYMBOLS = ["TestOnlyInWindowGlobalModule"]; +const EXPORTED_SYMBOLS = ["commandwindowglobalonly"]; -class TestOnlyInWindowGlobalModule { +class CommandWindowGlobalOnly { constructor(messageHandler) { this.messageHandler = messageHandler; } @@ -33,3 +33,5 @@ class TestOnlyInWindowGlobalModule { throw new Error("error-from-module"); } } + +const commandwindowglobalonly = CommandWindowGlobalOnly;