Bug 1368674 - Remove setTestName functionality from Marionette r?whimboo draft
authorDavid Burns <dburns@mozilla.com>
Tue, 30 May 2017 16:28:36 +0100
changeset 589593 4acd9e92ac47df86e5d98244365a40e9a8f612dc
parent 589592 7e48c0626f8ccf0b05bd7876123be12665a9e319
child 589594 81fd76dd9ca9f5198a5e7fcb373e6f5a52058680
child 589610 87d266282bff20a7d6f19007ed911c2072acb171
push id62440
push userbmo:dburns@mozilla.com
push dateTue, 06 Jun 2017 12:57:42 +0000
reviewerswhimboo
bugs1368674
milestone55.0a1
Bug 1368674 - Remove setTestName functionality from Marionette r?whimboo setTestName was used for logging which test was being run for the JS Tests used in B2G. MozReview-Commit-ID: FNF4Sm7vAYM
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
testing/marionette/harness/marionette_harness/marionette_test/testcases.py
testing/marionette/listener.js
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1331,17 +1331,16 @@ class Marionette(object):
         return self.session
 
     @property
     def test_name(self):
         return self._test_name
 
     @test_name.setter
     def test_name(self, test_name):
-        self._send_message("setTestName", {"value": test_name})
         self._test_name = test_name
 
     def delete_session(self, send_request=True, reset_session_id=False):
         """Close the current session and disconnect from the server.
 
         :param send_request: Optional, if `True` a request to close the session on
             the server side will be send. Use `False` in case of eg. in_app restart()
             or quit(), which trigger a deletion themselves. Defaults to `True`.
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2343,25 +2343,16 @@ GeckoDriver.prototype.sendKeysToElement 
       break;
 
     case Context.CONTENT:
       yield this.listener.sendKeysToElement(id, text);
       break;
   }
 };
 
-/** Sets the test name.  The test name is used for logging purposes. */
-GeckoDriver.prototype.setTestName = function*(cmd, resp) {
-  assert.window(this.getCurrentWindow());
-
-  let val = cmd.parameters.value;
-  this.testName = val;
-  yield this.listener.setTestName({value: val});
-};
-
 /**
  * Clear the text of an element.
  *
  * @param {string} id
  *     Reference ID to the element that will be cleared.
  *
  * @throws {NoSuchWindowError}
  *     Top-level browsing context has been discarded.
--- a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
+++ b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
@@ -1,31 +1,29 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import imp
-import os
 import re
 import sys
 import time
 import types
 import unittest
 import warnings
 import weakref
 
 from unittest.case import (
     _ExpectedFailure,
     _UnexpectedSuccess,
     SkipTest,
 )
 
 from marionette_driver.errors import (
     MarionetteException,
-    ScriptTimeoutException,
     TimeoutException,
 )
 from mozlog import get_default_logger
 
 
 def _wraps_parameterized(func, func_suffix, args, kwargs):
     """Internal: Decorator used in class MetaParameterized."""
     def wrapper(self):
@@ -331,33 +329,31 @@ class MarionetteTestCase(CommonTestCase)
                                       methodName=testname,
                                       filepath=filepath,
                                       testvars=testvars,
                                       **kwargs))
 
     def setUp(self):
         super(MarionetteTestCase, self).setUp()
         self.marionette.test_name = self.test_name
-        self.marionette.execute_script("log('TEST-START: {0}:{1}')"
-                                       .format(self.filepath.replace('\\', '\\\\'),
-                                               self.methodName),
+        self.marionette.execute_script("log('TEST-START: {0}')"
+                                       .format(self.test_name),
                                        sandbox="simpletest")
 
     def tearDown(self):
         # In the case no session is active (eg. the application was quit), start
         # a new session for clean-up steps.
         if not self.marionette.session:
             self.marionette.start_session()
 
         if not self.marionette.crashed:
             try:
                 self.marionette.clear_imported_scripts()
-                self.marionette.execute_script("log('TEST-END: {0}:{1}')"
-                                               .format(self.filepath.replace('\\', '\\\\'),
-                                                       self.methodName),
+                self.marionette.execute_script("log('TEST-END: {0}')"
+                                               .format(self.test_name),
                                                sandbox="simpletest")
                 self.marionette.test_name = None
             except (MarionetteException, IOError):
                 # We have tried to log the test end when there is no listener
                 # object that we can access
                 pass
 
         super(MarionetteTestCase, self).tearDown()
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -525,17 +525,16 @@ function startListeners() {
   addMessageListenerId("Marionette:sendKeysToElement", sendKeysToElementFn);
   addMessageListenerId("Marionette:clearElement", clearElementFn);
   addMessageListenerId("Marionette:switchToFrame", switchToFrame);
   addMessageListenerId("Marionette:switchToParentFrame", switchToParentFrame);
   addMessageListenerId("Marionette:switchToShadowRoot", switchToShadowRootFn);
   addMessageListenerId("Marionette:deleteSession", deleteSession);
   addMessageListenerId("Marionette:sleepSession", sleepSession);
   addMessageListenerId("Marionette:getAppCacheStatus", getAppCacheStatus);
-  addMessageListenerId("Marionette:setTestName", setTestName);
   addMessageListenerId("Marionette:takeScreenshot", takeScreenshotFn);
   addMessageListenerId("Marionette:addCookie", addCookieFn);
   addMessageListenerId("Marionette:getCookies", getCookiesFn);
   addMessageListenerId("Marionette:deleteAllCookies", deleteAllCookiesFn);
   addMessageListenerId("Marionette:deleteCookie", deleteCookieFn);
 }
 
 /**
@@ -600,17 +599,16 @@ function deleteSession(msg) {
   removeMessageListenerId("Marionette:sendKeysToElement", sendKeysToElementFn);
   removeMessageListenerId("Marionette:clearElement", clearElementFn);
   removeMessageListenerId("Marionette:switchToFrame", switchToFrame);
   removeMessageListenerId("Marionette:switchToParentFrame", switchToParentFrame);
   removeMessageListenerId("Marionette:switchToShadowRoot", switchToShadowRootFn);
   removeMessageListenerId("Marionette:deleteSession", deleteSession);
   removeMessageListenerId("Marionette:sleepSession", sleepSession);
   removeMessageListenerId("Marionette:getAppCacheStatus", getAppCacheStatus);
-  removeMessageListenerId("Marionette:setTestName", setTestName);
   removeMessageListenerId("Marionette:takeScreenshot", takeScreenshotFn);
   removeMessageListenerId("Marionette:addCookie", addCookieFn);
   removeMessageListenerId("Marionette:getCookies", getCookiesFn);
   removeMessageListenerId("Marionette:deleteAllCookies", deleteAllCookiesFn);
   removeMessageListenerId("Marionette:deleteCookie", deleteCookieFn);
 
   seenEls.clear();
   // reset container frame to the top-most frame
@@ -753,24 +751,16 @@ function* executeInSandbox(script, args,
   let res = yield evaluatePromise;
   sendSyncMessage(
       "Marionette:shareData",
       {log: evaluate.toJSON(contentLog.get(), seenEls)});
   return evaluate.toJSON(res, seenEls);
 }
 
 /**
- * Sets the test name, used in logging messages.
- */
-function setTestName(msg) {
-  marionetteTestName = msg.json.value;
-  sendOk(msg.json.command_id);
-}
-
-/**
  * This function creates a touch event given a touch type and a touch
  */
 function emitTouchEvent(type, touch) {
   if (!wasInterrupted()) {
     logger.info(`Emitting Touch event of type ${type} to element with id: ${touch.target.id} ` +
                 `and tag name: ${touch.target.tagName} at coordinates (${touch.clientX}, ` +
                 `${touch.clientY}) relative to the viewport`);