Skip to content

Commit

Permalink
test: Fix test failure due to unconditional extension API usage
Browse files Browse the repository at this point in the history
This test failure was introduced in 8d09fea.

Change-Id: Ibdce76e43fda310c699070e0355b0b6bb7b6e01a
  • Loading branch information
joeyparrish committed Nov 15, 2021
1 parent 7c08d75 commit e8ac1fb
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions log-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,23 @@ function prettyPrint(obj, indentation = '') {
return obj.toString();
}

/**
* Listens for messages from the content script to append a log item to the
* current frame and log file.
*/
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
const log = request.log;
EmeLogWindow.instance.appendLog(log);
});
// NOTE: These APIs are not defined in our test environment, but should always
// be present when this is run as a Chrome extension.
if (chrome.runtime !== undefined) {
/**
* Listens for messages from the content script to append a log item to the
* current frame and log file.
*/
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
const log = request.log;
EmeLogWindow.instance.appendLog(log);
});

/**
* When the extension icon is clicked, open the log window if it doesn't exist,
* and bring it to the front otherwise.
*/
chrome.browserAction.onClicked.addListener((tab) => {
EmeLogWindow.instance.open();
});
/**
* When the extension icon is clicked, open the log window if it doesn't exist,
* and bring it to the front otherwise.
*/
chrome.browserAction.onClicked.addListener((tab) => {
EmeLogWindow.instance.open();
});
}

0 comments on commit e8ac1fb

Please sign in to comment.