B2G/gecko/uriloader/exthandler/tests/unit/test_getTypeFromExtension_with_empty_Content_Type.js
/**
   * Constructs a new mock registry key by wrapping the provided object.
   *
   * This mock implementation is tailored for this test, and forces consumers
   * of the readStringValue method to believe that the "Content Type" value of
   * the ".txt" key under HKEY_CLASSES_ROOT is an empty string.
   *
   * The same value read from "HKEY_LOCAL_MACHINE\SOFTWARE\Classes" is not
   * affected.
   *
   * @param aWrappedObject   An actual nsIWindowsRegKey implementation.
   */
Constructs a new mock registry key by wrapping the provided object.
This mock implementation is tailored for this test, and forces consumers
of the readStringValue method to believe that the "Content Type" value of
the ".txt" key under HKEY_CLASSES_ROOT is an empty string.

The same value read from "HKEY_LOCAL_MACHINE\SOFTWARE\Classes" is not
affected.


Constructs a new mock registry key by wrapping the provided object . This mock implementation is tailored for this test and forces consumers of the readStringValue method to believe that the " Content Type " value of the " . txt " key under HKEY_CLASSES_ROOT is an empty string . The same value read from " HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes " is not affected .
function MockWindowsRegKey(aWrappedObject) {
    this._wrappedObject = aWrappedObject;
    function makeForwardingFunction(functionName) {
      return function() {
        return aWrappedObject[functionName].apply(aWrappedObject, arguments);
      }
    }
    for (var propertyName in aWrappedObject) {
      if (!(propertyName in this)) {
        if (typeof aWrappedObject[propertyName] == "function") {
          this[propertyName] = makeForwardingFunction(propertyName);
        } else {
          this[propertyName] = aWrappedObject[propertyName];
        }
      }
    }
  }
function MockWindowsRegKey ( aWrappedObject ) { this . _wrappedObject = aWrappedObject ; function makeForwardingFunction ( functionName ) { return function ( ) { return aWrappedObject [ functionName ] . apply ( aWrappedObject , arguments ) ; } } for ( var propertyName in aWrappedObject ) { if ( ! ( propertyName in this ) ) { if ( typeof aWrappedObject [ propertyName ] == "function" ) { this [ propertyName ] = makeForwardingFunction ( propertyName ) ; } else { this [ propertyName ] = aWrappedObject [ propertyName ] ; } } } }
Constructs a new mock registry key by wrapping the provided object.
Constructs a new mock registry key by wrapping the provided object .
// This function creates a forwarding function for wrappedObject // Forward all the functions that are not explicitly overridden