Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrome-mock

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-mock - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

chrome-mock-browser.js

2

lib/Chrome.js
var ContextMenus = require('./chrome/ContextMenus');
var Runtime = require('./chrome/Runtime');
var Tabs = require('./chrome/Tabs');

@@ -12,2 +13,3 @@ module.exports = Chrome;

this.runtime = new Runtime(this);
this.tabs = new Tabs(this);
}
var Event = require('../Event');
var sinon = require('sinon');

@@ -11,3 +12,73 @@ module.exports = Runtime;

this.chrome = chrome;
this.onInstalled = new Event();
this.onStartup = new Event();
this.onInstalled = new Event();
this.onSuspend = new Event();
this.onSuspendCanceled = new Event();
this.onUpdateAvailable = new Event();
this.onBrowserUpdateAvailable = new Event();
this.onConnect = new Event();
this.onConnectExternal = new Event();
this.onMessage = new Event();
this.onMessageExternal = new Event();
this.onRestartRequired = new Event();
this.getBackgroundPage = sinon.spy(this.getBackgroundPage.bind(this));
this.getManifest = sinon.spy(this.getManifest.bind(this));
this.getURL = sinon.spy(this.getURL.bind(this));
this.reload = sinon.spy(this.reload.bind(this));
}
/**
* This will be defined during an API method callback
* if there was an error.
* @property {object}
*/
Runtime.prototype.lastError = null;
/**
* The ID of the extension/app.
* @property {string}
*/
Runtime.prototype.id = 'xxxxxxxxxxxxxxxx';
/**
* Retrieves the JavaScript 'window' object for the background page
* running inside the current extension/app. If the background page
* is an event page, the system will ensure it is loaded before
* calling the callback. If there is no background page, an error
* is set.
* @param {function} callback
*/
Runtime.prototype.getBackgroundPage = function (callback) {
if (typeof callback === 'function') {
callback({});
}
};
/**
* Returns details about the app or extension from the manifest.
* The object returned is a serialization of the full manifest file.
* @returns {object} The manifest details
*/
Runtime.prototype.getManifest = function () {
return {
version: '0.0.1'
};
};
/**
* Converts a relative path within an app/extension install directory
* to a fully-qualified URL.
* @param {string} path A path to a resource within an app/extension
* expressed relative to its install directory.
* @returns {string}
*/
Runtime.prototype.getURL = function (path) {
return ['chrome://', this.id, '/', path].join('');
};
/**
* Reloads the app or extension.
*/
Runtime.prototype.reload = function () {};

8

package.json
{
"name": "chrome-mock",
"version": "0.0.2",
"version": "0.0.3",
"author": "Steven Foote & Seth McLaughlin",

@@ -11,3 +11,4 @@ "license": "MIT",

"require-dir": "^0.1.0",
"sinon": "^1.10.3"
"sinon": "^1.10.3",
"rfile": "~1.0.0"
},

@@ -32,4 +33,5 @@ "devDependencies": {

"grunt-browserify": "~2.1.4",
"load-grunt-tasks": "~0.6.0"
"load-grunt-tasks": "~0.6.0",
"ejs": "~1.0.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc