mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Add prettier and re-format .js files
This commit is contained in:
@@ -9,56 +9,54 @@ const env = jasmine.getEnv();
|
||||
// Copy to window
|
||||
Object.assign(window, jasmineRequire.interface(jasmine, env));
|
||||
|
||||
|
||||
// Create query string
|
||||
const queryString = new jasmine.QueryString({
|
||||
getWindowLocation () {
|
||||
getWindowLocation() {
|
||||
return window.location;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// If spec is present in the query string
|
||||
const filterSpecs = !!queryString.getParam("spec");
|
||||
|
||||
// Create HTML reporter
|
||||
const htmlReporter = new jasmine.HtmlReporter({
|
||||
env
|
||||
, filterSpecs
|
||||
, timer: new jasmine.Timer()
|
||||
env,
|
||||
filterSpecs,
|
||||
timer: new jasmine.Timer(),
|
||||
|
||||
, getContainer () {
|
||||
getContainer() {
|
||||
return document.body;
|
||||
}
|
||||
},
|
||||
|
||||
// Bound functions
|
||||
, navigateWithNewParam: queryString.navigateWithNewParam.bind(queryString)
|
||||
, addToExistingQueryString: queryString.fullStringWithNewParam.bind(queryString)
|
||||
, createElement: document.createElement.bind(document)
|
||||
, createTextNode: document.createTextNode.bind(document)
|
||||
navigateWithNewParam: queryString.navigateWithNewParam.bind(queryString),
|
||||
addToExistingQueryString:
|
||||
queryString.fullStringWithNewParam.bind(queryString),
|
||||
createElement: document.createElement.bind(document),
|
||||
createTextNode: document.createTextNode.bind(document)
|
||||
});
|
||||
|
||||
// Create spec filter
|
||||
const specFilter = new jasmine.HtmlSpecFilter({
|
||||
filterString () {
|
||||
filterString() {
|
||||
return queryString.getParam("spec");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Add reporters
|
||||
env.addReporter(jsApiReporter);
|
||||
env.addReporter(htmlReporter);
|
||||
|
||||
// Configure Env
|
||||
env.configure({
|
||||
failFast : queryString.getParam("failFast")
|
||||
, hideDisabled : queryString.getParam("hideDisabled")
|
||||
, oneFailurePerSpec : queryString.getParam("oneFailurePerSpec")
|
||||
, random : queryString.getParam("random")
|
||||
, seed : queryString.getParam("seed")
|
||||
failFast: queryString.getParam("failFast"),
|
||||
hideDisabled: queryString.getParam("hideDisabled"),
|
||||
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
|
||||
random: queryString.getParam("random"),
|
||||
seed: queryString.getParam("seed"),
|
||||
|
||||
, specFilter (spec) {
|
||||
specFilter(spec) {
|
||||
return specFilter.matches(spec.getFullName());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,20 +15,19 @@ const chrome = require("selenium-webdriver/chrome");
|
||||
// Webdriver shorthands
|
||||
const { By, until } = webdriver;
|
||||
|
||||
|
||||
const { __extensionName
|
||||
, __extensionVersion } = require("../ext/package.json");
|
||||
const { __extensionName, __extensionVersion } = require("../ext/package.json");
|
||||
|
||||
const extensionArchivePath = path.join(
|
||||
__dirname, "../dist/ext"
|
||||
, `${__extensionName}-${__extensionVersion}.xpi`)
|
||||
__dirname,
|
||||
"../dist/ext",
|
||||
`${__extensionName}-${__extensionVersion}.xpi`
|
||||
);
|
||||
|
||||
if (!fs.existsSync(extensionArchivePath)) {
|
||||
console.error("Extension archive not found.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
const TEST_PAGE_URL = `file:///${__dirname}/SpecRunner.html`;
|
||||
const POLLING_PAGE_URL = `file:///${__dirname}/polling.html`;
|
||||
|
||||
@@ -37,10 +36,10 @@ const firefoxOptions = new firefox.Options()
|
||||
.addExtensions(extensionArchivePath)
|
||||
.setPreference("xpinstall.signatures.required", false);
|
||||
|
||||
const chromeOptions = new chrome.Options()
|
||||
.excludeSwitches([ "disable-background-networking"
|
||||
, "disable-default-apps"]);
|
||||
|
||||
const chromeOptions = new chrome.Options().excludeSwitches([
|
||||
"disable-background-networking",
|
||||
"disable-default-apps"
|
||||
]);
|
||||
|
||||
/**
|
||||
* Chrome doesn't load the media router extension immediately
|
||||
@@ -50,11 +49,11 @@ const chromeOptions = new chrome.Options()
|
||||
* Workaround is to poll every 100ms, refresh the page, and
|
||||
* check whether the chrome.cast API objects are defined.
|
||||
*/
|
||||
function waitUntilDefined (
|
||||
driver
|
||||
, pollingTimeout = 10000
|
||||
, pollingFrequency = 100) {
|
||||
|
||||
function waitUntilDefined(
|
||||
driver,
|
||||
pollingTimeout = 10000,
|
||||
pollingFrequency = 100
|
||||
) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let elapsedTime = pollingFrequency;
|
||||
|
||||
@@ -92,7 +91,7 @@ function waitUntilDefined (
|
||||
* channel.
|
||||
*/
|
||||
class MessageProxy extends EventEmitter {
|
||||
constructor () {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const wss = new WebSocket.Server({
|
||||
@@ -104,7 +103,7 @@ class MessageProxy extends EventEmitter {
|
||||
const messageContent = JSON.parse(message);
|
||||
this.emit(messageContent.subject, messageContent.data);
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +111,13 @@ class MessageProxy extends EventEmitter {
|
||||
* Ensures cast API is loaded before finding and injecting spec
|
||||
* file scripts into the test page.
|
||||
*/
|
||||
async function injectSpecs (driver) {
|
||||
const [ loaded, errorInfo ] = await driver.executeAsyncScript(() => {
|
||||
async function injectSpecs(driver) {
|
||||
const [loaded, errorInfo] = await driver.executeAsyncScript(() => {
|
||||
const callback = arguments[arguments.length - 1];
|
||||
|
||||
// If already loaded, return immediately
|
||||
if (chrome.cast !== undefined) {
|
||||
callback([ true ]);
|
||||
callback([true]);
|
||||
}
|
||||
|
||||
// Set Cast API callback
|
||||
@@ -133,7 +132,6 @@ async function injectSpecs (driver) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get spec files
|
||||
const specFiles = glob.sync("spec/**/*.spec.js", {
|
||||
cwd: __dirname
|
||||
@@ -171,7 +169,6 @@ async function injectSpecs (driver) {
|
||||
console.log("Cast extension loaded!");
|
||||
}
|
||||
|
||||
|
||||
// Create console reporter and message proxy.
|
||||
const reporter = new JasmineConsoleReporter();
|
||||
const messageProxy = new MessageProxy();
|
||||
@@ -185,12 +182,14 @@ async function injectSpecs (driver) {
|
||||
* Forward events from Jasmine standlone via message proxy to
|
||||
* console reporter.
|
||||
*/
|
||||
messageProxy.on("jasmineDone" , result => reporter.jasmineDone(result));
|
||||
messageProxy.on("jasmineStarted" , result => reporter.jasmineStarted(result));
|
||||
messageProxy.on("specDone" , result => reporter.specDone(result));
|
||||
messageProxy.on("specStarted" , result => reporter.specStarted(result));
|
||||
messageProxy.on("suiteDone" , result => reporter.suiteDone(result));
|
||||
messageProxy.on("suiteStarted" , result => reporter.suiteStarted(result));
|
||||
messageProxy.on("jasmineDone", result => reporter.jasmineDone(result));
|
||||
messageProxy.on("jasmineStarted", result =>
|
||||
reporter.jasmineStarted(result)
|
||||
);
|
||||
messageProxy.on("specDone", result => reporter.specDone(result));
|
||||
messageProxy.on("specStarted", result => reporter.specStarted(result));
|
||||
messageProxy.on("suiteDone", result => reporter.suiteDone(result));
|
||||
messageProxy.on("suiteStarted", result => reporter.suiteStarted(result));
|
||||
|
||||
// Load Jasmine test page
|
||||
driver.get(TEST_PAGE_URL);
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
const socket = new WebSocket("ws://localhost:8080");
|
||||
|
||||
window.messageProxy = {
|
||||
sendMessage (message) {
|
||||
sendMessage(message) {
|
||||
socket.send(JSON.stringify(message));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const reporterMethods = [
|
||||
"jasmineDone"
|
||||
, "jasmineStarted"
|
||||
, "specDone"
|
||||
, "specStarted"
|
||||
, "suiteDone"
|
||||
, "suiteStarted"
|
||||
"jasmineDone",
|
||||
"jasmineStarted",
|
||||
"specDone",
|
||||
"specStarted",
|
||||
"suiteDone",
|
||||
"suiteStarted"
|
||||
];
|
||||
|
||||
const customReporter = {};
|
||||
@@ -24,10 +24,10 @@ const customReporter = {};
|
||||
for (const method of reporterMethods) {
|
||||
customReporter[method] = function (result) {
|
||||
messageProxy.sendMessage({
|
||||
subject: method
|
||||
, data: result
|
||||
subject: method,
|
||||
data: result
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
socket.addEventListener("open", ev => {
|
||||
|
||||
@@ -16,17 +16,19 @@ describe("chrome.cast.ApiConfig", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const sessionRequest = new chrome.cast.SessionRequest(
|
||||
chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID);
|
||||
chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID
|
||||
);
|
||||
|
||||
function sessionListener () {}
|
||||
function receiverListener () {}
|
||||
function sessionListener() {}
|
||||
function receiverListener() {}
|
||||
|
||||
const apiConfig = new chrome.cast.ApiConfig(
|
||||
sessionRequest
|
||||
, sessionListener
|
||||
, receiverListener
|
||||
, chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED
|
||||
, chrome.cast.DefaultActionPolicy.CAST_THIS_TAB);
|
||||
sessionRequest,
|
||||
sessionListener,
|
||||
receiverListener,
|
||||
chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
|
||||
chrome.cast.DefaultActionPolicy.CAST_THIS_TAB
|
||||
);
|
||||
|
||||
expect(typeof apiConfig.sessionListener).toBe("function");
|
||||
expect(typeof apiConfig.receiverListener).toBe("function");
|
||||
|
||||
@@ -10,8 +10,9 @@ describe("chrome.cast.DialRequest", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const dialRequest = new chrome.cast.DialRequest(
|
||||
"testAppName"
|
||||
, "testLaunchParameter");
|
||||
"testAppName",
|
||||
"testLaunchParameter"
|
||||
);
|
||||
|
||||
expect(dialRequest.appName).toBe("testAppName");
|
||||
expect(dialRequest.launchParameter).toBe("testLaunchParameter");
|
||||
|
||||
@@ -11,13 +11,13 @@ describe("chrome.cast.Error", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const error = new chrome.cast.Error(
|
||||
chrome.cast.ErrorCode.CANCEL
|
||||
, "testErrorDescription"
|
||||
, { testErrorDetails: "testErrorDetails" });
|
||||
chrome.cast.ErrorCode.CANCEL,
|
||||
"testErrorDescription",
|
||||
{ testErrorDetails: "testErrorDetails" }
|
||||
);
|
||||
|
||||
expect(error.code).toBe("cancel");
|
||||
expect(error.description).toBe("testErrorDescription");
|
||||
expect(error.details).toEqual(
|
||||
{ testErrorDetails: "testErrorDetails" });
|
||||
expect(error.details).toEqual({ testErrorDetails: "testErrorDetails" });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,15 +15,20 @@ describe("chrome.cast.Receiver", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const receiver = new chrome.cast.Receiver(
|
||||
"testLabel"
|
||||
, "testFriendlyName"
|
||||
, [ chrome.cast.Capability.VIDEO_OUT
|
||||
, chrome.cast.Capability.AUDIO_OUT ]
|
||||
, new chrome.cast.Volume(1, false));
|
||||
"testLabel",
|
||||
"testFriendlyName",
|
||||
[
|
||||
chrome.cast.Capability.VIDEO_OUT,
|
||||
chrome.cast.Capability.AUDIO_OUT
|
||||
],
|
||||
new chrome.cast.Volume(1, false)
|
||||
);
|
||||
|
||||
expect(receiver.capabilities).toEqual([ "video_out", "audio_out" ]);
|
||||
expect(receiver.capabilities).toEqual(["video_out", "audio_out"]);
|
||||
expect(receiver.friendlyName).toBe("testFriendlyName");
|
||||
expect(receiver.label).toBe("testLabel");
|
||||
expect(receiver.volume).toEqual(jasmine.objectContaining({ level: 1, muted: false }));
|
||||
expect(receiver.volume).toEqual(
|
||||
jasmine.objectContaining({ level: 1, muted: false })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
describe("chrome.cast.ReceiverDisplayStatus", () => {
|
||||
it("should have all properties", async () => {
|
||||
const receiverDisplayStatus =
|
||||
new chrome.cast.ReceiverDisplayStatus();
|
||||
const receiverDisplayStatus = new chrome.cast.ReceiverDisplayStatus();
|
||||
|
||||
expect(typeof receiverDisplayStatus.appImages).toBe("undefined");
|
||||
expect(typeof receiverDisplayStatus.statusText).toBe("undefined");
|
||||
@@ -12,14 +11,27 @@ describe("chrome.cast.ReceiverDisplayStatus", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const receiverDisplayStatus = new chrome.cast.ReceiverDisplayStatus(
|
||||
"testStatusText"
|
||||
, [
|
||||
new chrome.cast.Image("http://example.com/1")
|
||||
, new chrome.cast.Image("http://example.com/2")
|
||||
]);
|
||||
"testStatusText",
|
||||
[
|
||||
new chrome.cast.Image("http://example.com/1"),
|
||||
new chrome.cast.Image("http://example.com/2")
|
||||
]
|
||||
);
|
||||
|
||||
expect(receiverDisplayStatus.statusText).toBe("testStatusText");
|
||||
expect(receiverDisplayStatus.appImages).toContain(jasmine.objectContaining({ url: "http://example.com/1", height: null, width: null }))
|
||||
expect(receiverDisplayStatus.appImages).toContain(jasmine.objectContaining({ url: "http://example.com/2", height: null, width: null }))
|
||||
expect(receiverDisplayStatus.appImages).toContain(
|
||||
jasmine.objectContaining({
|
||||
url: "http://example.com/1",
|
||||
height: null,
|
||||
width: null
|
||||
})
|
||||
);
|
||||
expect(receiverDisplayStatus.appImages).toContain(
|
||||
jasmine.objectContaining({
|
||||
url: "http://example.com/2",
|
||||
height: null,
|
||||
width: null
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,8 @@ describe("chrome.cast.SenderApplication", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const senderApplication = new chrome.cast.SenderApplication(
|
||||
chrome.cast.SenderPlatform.CHROME);
|
||||
chrome.cast.SenderPlatform.CHROME
|
||||
);
|
||||
|
||||
expect(senderApplication.platform).toBe("chrome");
|
||||
});
|
||||
|
||||
@@ -19,16 +19,19 @@ describe("chrome.cast.Session", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const session = new chrome.cast.Session(
|
||||
"__sessionId"
|
||||
, "__appId"
|
||||
, "__displayName"
|
||||
, [ new chrome.cast.Image("http://example.com") ]
|
||||
, new chrome.cast.Receiver("__label", "__friendlyName"));
|
||||
"__sessionId",
|
||||
"__appId",
|
||||
"__displayName",
|
||||
[new chrome.cast.Image("http://example.com")],
|
||||
new chrome.cast.Receiver("__label", "__friendlyName")
|
||||
);
|
||||
|
||||
expect(session.appId).toBe("__appId");
|
||||
expect(session.appImages).toEqual(jasmine.arrayContaining([
|
||||
jasmine.objectContaining({ url: "http://example.com" })
|
||||
]));
|
||||
expect(session.appImages).toEqual(
|
||||
jasmine.arrayContaining([
|
||||
jasmine.objectContaining({ url: "http://example.com" })
|
||||
])
|
||||
);
|
||||
expect(session.displayName).toBe("__displayName");
|
||||
expect(session.receiver).toEqual(jasmine.any(chrome.cast.Receiver));
|
||||
expect(session.sessionId).toBe("__sessionId");
|
||||
|
||||
@@ -5,7 +5,7 @@ describe("chrome.cast.SessionRequest", () => {
|
||||
const sessionRequest = new chrome.cast.SessionRequest();
|
||||
|
||||
expect(sessionRequest.appId).toBe(undefined);
|
||||
expect(sessionRequest.capabilities).toEqual([ "video_out", "audio_out" ]);
|
||||
expect(sessionRequest.capabilities).toEqual(["video_out", "audio_out"]);
|
||||
expect(sessionRequest.dialRequest).toBe(null);
|
||||
expect(sessionRequest.language).toBe(null);
|
||||
expect(sessionRequest.requestSessionTimeout).toBe(60000);
|
||||
@@ -13,13 +13,13 @@ describe("chrome.cast.SessionRequest", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const sessionRequest = new chrome.cast.SessionRequest(
|
||||
"__appId"
|
||||
, [ chrome.cast.Capability.VIDEO_OUT
|
||||
, chrome.cast.Capability.AUDIO_IN ]
|
||||
, 5000);
|
||||
"__appId",
|
||||
[chrome.cast.Capability.VIDEO_OUT, chrome.cast.Capability.AUDIO_IN],
|
||||
5000
|
||||
);
|
||||
|
||||
expect(sessionRequest.appId).toBe("__appId");
|
||||
expect(sessionRequest.capabilities).toEqual([ "video_out", "audio_in" ]);
|
||||
expect(sessionRequest.capabilities).toEqual(["video_out", "audio_in"]);
|
||||
expect(sessionRequest.requestSessionTimeout).toBe(5000);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,84 +41,106 @@ describe("chrome", () => {
|
||||
});
|
||||
|
||||
it("should have all api enums", () => {
|
||||
expect(chrome.cast.AutoJoinPolicy).toEqual(jasmine.objectContaining({
|
||||
CUSTOM_CONTROLLER_SCOPED: "custom_controller_scoped"
|
||||
, TAB_AND_ORIGIN_SCOPED: "tab_and_origin_scoped"
|
||||
, ORIGIN_SCOPED: "origin_scoped"
|
||||
, PAGE_SCOPED: "page_scoped"
|
||||
}));
|
||||
expect(chrome.cast.AutoJoinPolicy).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CUSTOM_CONTROLLER_SCOPED: "custom_controller_scoped",
|
||||
TAB_AND_ORIGIN_SCOPED: "tab_and_origin_scoped",
|
||||
ORIGIN_SCOPED: "origin_scoped",
|
||||
PAGE_SCOPED: "page_scoped"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.Capability).toEqual(jasmine.objectContaining({
|
||||
VIDEO_OUT: "video_out"
|
||||
, AUDIO_OUT: "audio_out"
|
||||
, VIDEO_IN: "video_in"
|
||||
, AUDIO_IN: "audio_in"
|
||||
, MULTIZONE_GROUP: "multizone_group"
|
||||
}));
|
||||
expect(chrome.cast.Capability).toEqual(
|
||||
jasmine.objectContaining({
|
||||
VIDEO_OUT: "video_out",
|
||||
AUDIO_OUT: "audio_out",
|
||||
VIDEO_IN: "video_in",
|
||||
AUDIO_IN: "audio_in",
|
||||
MULTIZONE_GROUP: "multizone_group"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.DefaultActionPolicy).toEqual(jasmine.objectContaining({
|
||||
CREATE_SESSION: "create_session"
|
||||
, CAST_THIS_TAB: "cast_this_tab"
|
||||
}));
|
||||
expect(chrome.cast.DefaultActionPolicy).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CREATE_SESSION: "create_session",
|
||||
CAST_THIS_TAB: "cast_this_tab"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.DialAppState).toEqual(jasmine.objectContaining({
|
||||
RUNNING: "running"
|
||||
, STOPPED: "stopped"
|
||||
, ERROR: "error"
|
||||
}));
|
||||
expect(chrome.cast.DialAppState).toEqual(
|
||||
jasmine.objectContaining({
|
||||
RUNNING: "running",
|
||||
STOPPED: "stopped",
|
||||
ERROR: "error"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.ErrorCode).toEqual(jasmine.objectContaining({
|
||||
CANCEL: "cancel"
|
||||
, TIMEOUT: "timeout"
|
||||
, API_NOT_INITIALIZED: "api_not_initialized"
|
||||
, INVALID_PARAMETER: "invalid_parameter"
|
||||
, EXTENSION_NOT_COMPATIBLE: "extension_not_compatible"
|
||||
, EXTENSION_MISSING: "extension_missing"
|
||||
, RECEIVER_UNAVAILABLE: "receiver_unavailable"
|
||||
, SESSION_ERROR: "session_error"
|
||||
, CHANNEL_ERROR: "channel_error"
|
||||
, LOAD_MEDIA_FAILED: "load_media_failed"
|
||||
}));
|
||||
expect(chrome.cast.ErrorCode).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CANCEL: "cancel",
|
||||
TIMEOUT: "timeout",
|
||||
API_NOT_INITIALIZED: "api_not_initialized",
|
||||
INVALID_PARAMETER: "invalid_parameter",
|
||||
EXTENSION_NOT_COMPATIBLE: "extension_not_compatible",
|
||||
EXTENSION_MISSING: "extension_missing",
|
||||
RECEIVER_UNAVAILABLE: "receiver_unavailable",
|
||||
SESSION_ERROR: "session_error",
|
||||
CHANNEL_ERROR: "channel_error",
|
||||
LOAD_MEDIA_FAILED: "load_media_failed"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.ReceiverAction).toEqual(jasmine.objectContaining({
|
||||
CAST: "cast"
|
||||
, STOP: "stop"
|
||||
}));
|
||||
expect(chrome.cast.ReceiverAction).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CAST: "cast",
|
||||
STOP: "stop"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.ReceiverAvailability).toEqual(jasmine.objectContaining({
|
||||
AVAILABLE: "available"
|
||||
, UNAVAILABLE: "unavailable"
|
||||
}));
|
||||
expect(chrome.cast.ReceiverAvailability).toEqual(
|
||||
jasmine.objectContaining({
|
||||
AVAILABLE: "available",
|
||||
UNAVAILABLE: "unavailable"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.ReceiverType).toEqual(jasmine.objectContaining({
|
||||
CAST: "cast"
|
||||
, DIAL: "dial"
|
||||
, HANGOUT: "hangout"
|
||||
, CUSTOM: "custom"
|
||||
}));
|
||||
expect(chrome.cast.ReceiverType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CAST: "cast",
|
||||
DIAL: "dial",
|
||||
HANGOUT: "hangout",
|
||||
CUSTOM: "custom"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.SenderPlatform).toEqual(jasmine.objectContaining({
|
||||
CHROME: "chrome"
|
||||
, IOS: "ios"
|
||||
, ANDROID: "android"
|
||||
}));
|
||||
expect(chrome.cast.SenderPlatform).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CHROME: "chrome",
|
||||
IOS: "ios",
|
||||
ANDROID: "android"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.SessionStatus).toEqual(jasmine.objectContaining({
|
||||
CONNECTED: "connected"
|
||||
, DISCONNECTED: "disconnected"
|
||||
, STOPPED: "stopped"
|
||||
}));
|
||||
expect(chrome.cast.SessionStatus).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CONNECTED: "connected",
|
||||
DISCONNECTED: "disconnected",
|
||||
STOPPED: "stopped"
|
||||
})
|
||||
);
|
||||
|
||||
expect(chrome.cast.VolumeControlType).toEqual(jasmine.objectContaining({
|
||||
ATTENUATION: "attenuation"
|
||||
, FIXED: "fixed"
|
||||
, MASTER: "master"
|
||||
}));
|
||||
expect(chrome.cast.VolumeControlType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
ATTENUATION: "attenuation",
|
||||
FIXED: "fixed",
|
||||
MASTER: "master"
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("chrome.cast.media", () => {
|
||||
it ("should have all api classes", () => {
|
||||
it("should have all api classes", () => {
|
||||
expect(chrome.cast.media.EditTracksInfoRequest).toBeDefined();
|
||||
expect(chrome.cast.media.GenericMediaMetadata).toBeDefined();
|
||||
expect(chrome.cast.media.GetStatusRequest).toBeDefined();
|
||||
@@ -144,90 +166,116 @@ describe("chrome", () => {
|
||||
expect(chrome.cast.media.VolumeRequest).toBeDefined();
|
||||
});
|
||||
|
||||
it ("should have all api enums", () => {
|
||||
expect(chrome.cast.media.IdleReason).toEqual(jasmine.objectContaining({
|
||||
CANCELLED: "CANCELLED"
|
||||
, INTERRUPTED: "INTERRUPTED"
|
||||
, FINISHED: "FINISHED"
|
||||
, ERROR: "ERROR"
|
||||
}));
|
||||
expect(chrome.cast.media.MediaCommand).toEqual(jasmine.objectContaining({
|
||||
PAUSE: "pause"
|
||||
, SEEK: "seek"
|
||||
, STREAM_VOLUME: "stream_volume"
|
||||
, STREAM_MUTE: "stream_mute"
|
||||
}));
|
||||
expect(chrome.cast.media.MetadataType).toEqual(jasmine.objectContaining({
|
||||
GENERIC: 0
|
||||
, MOVIE: 1
|
||||
, TV_SHOW: 2
|
||||
, MUSIC_TRACK: 3
|
||||
, PHOTO: 4
|
||||
}));
|
||||
expect(chrome.cast.media.PlayerState).toEqual(jasmine.objectContaining({
|
||||
IDLE: "IDLE"
|
||||
, PLAYING: "PLAYING"
|
||||
, PAUSED: "PAUSED"
|
||||
, BUFFERING: "BUFFERING"
|
||||
}));
|
||||
expect(chrome.cast.media.RepeatMode).toEqual(jasmine.objectContaining({
|
||||
OFF: "REPEAT_OFF"
|
||||
, ALL: "REPEAT_ALL"
|
||||
, SINGLE: "REPEAT_SINGLE"
|
||||
, ALL_AND_SHUFFLE: "REPEAT_ALL_AND_SHUFFLE"
|
||||
}));
|
||||
expect(chrome.cast.media.ResumeState).toEqual(jasmine.objectContaining({
|
||||
PLAYBACK_START: "PLAYBACK_START"
|
||||
, PLAYBACK_PAUSE: "PLAYBACK_PAUSE"
|
||||
}));
|
||||
expect(chrome.cast.media.StreamType).toEqual(jasmine.objectContaining({
|
||||
BUFFERED: "BUFFERED"
|
||||
, LIVE: "LIVE"
|
||||
, OTHER: "OTHER"
|
||||
}));
|
||||
expect(chrome.cast.media.TextTrackEdgeType).toEqual(jasmine.objectContaining({
|
||||
NONE: "NONE"
|
||||
, OUTLINE: "OUTLINE"
|
||||
, DROP_SHADOW: "DROP_SHADOW"
|
||||
, RAISED: "RAISED"
|
||||
, DEPRESSED: "DEPRESSED"
|
||||
}));
|
||||
expect(chrome.cast.media.TextTrackFontGenericFamily).toEqual(jasmine.objectContaining({
|
||||
SANS_SERIF: "SANS_SERIF"
|
||||
, MONOSPACED_SANS_SERIF: "MONOSPACED_SANS_SERIF"
|
||||
, SERIF: "SERIF"
|
||||
, MONOSPACED_SERIF: "MONOSPACED_SERIF"
|
||||
, CASUAL: "CASUAL"
|
||||
, CURSIVE: "CURSIVE"
|
||||
, SMALL_CAPITALS: "SMALL_CAPITALS"
|
||||
}));
|
||||
expect(chrome.cast.media.TextTrackFontStyle).toEqual(jasmine.objectContaining({
|
||||
NORMAL: "NORMAL"
|
||||
, BOLD: "BOLD"
|
||||
, BOLD_ITALIC: "BOLD_ITALIC"
|
||||
, ITALIC: "ITALIC"
|
||||
}));
|
||||
expect(chrome.cast.media.TextTrackType).toEqual(jasmine.objectContaining({
|
||||
SUBTITLES: "SUBTITLES"
|
||||
, CAPTIONS: "CAPTIONS"
|
||||
, DESCRIPTIONS: "DESCRIPTIONS"
|
||||
, CHAPTERS: "CHAPTERS"
|
||||
, METADATA: "METADATA"
|
||||
}));
|
||||
expect(chrome.cast.media.TextTrackWindowType).toEqual(jasmine.objectContaining({
|
||||
NONE: "NONE"
|
||||
, NORMAL: "NORMAL"
|
||||
, ROUNDED_CORNERS: "ROUNDED_CORNERS"
|
||||
}));
|
||||
expect(chrome.cast.media.TrackType).toEqual(jasmine.objectContaining({
|
||||
TEXT: "TEXT"
|
||||
, AUDIO: "AUDIO"
|
||||
, VIDEO: "VIDEO"
|
||||
}));
|
||||
it("should have all api enums", () => {
|
||||
expect(chrome.cast.media.IdleReason).toEqual(
|
||||
jasmine.objectContaining({
|
||||
CANCELLED: "CANCELLED",
|
||||
INTERRUPTED: "INTERRUPTED",
|
||||
FINISHED: "FINISHED",
|
||||
ERROR: "ERROR"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.MediaCommand).toEqual(
|
||||
jasmine.objectContaining({
|
||||
PAUSE: "pause",
|
||||
SEEK: "seek",
|
||||
STREAM_VOLUME: "stream_volume",
|
||||
STREAM_MUTE: "stream_mute"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.MetadataType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
GENERIC: 0,
|
||||
MOVIE: 1,
|
||||
TV_SHOW: 2,
|
||||
MUSIC_TRACK: 3,
|
||||
PHOTO: 4
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.PlayerState).toEqual(
|
||||
jasmine.objectContaining({
|
||||
IDLE: "IDLE",
|
||||
PLAYING: "PLAYING",
|
||||
PAUSED: "PAUSED",
|
||||
BUFFERING: "BUFFERING"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.RepeatMode).toEqual(
|
||||
jasmine.objectContaining({
|
||||
OFF: "REPEAT_OFF",
|
||||
ALL: "REPEAT_ALL",
|
||||
SINGLE: "REPEAT_SINGLE",
|
||||
ALL_AND_SHUFFLE: "REPEAT_ALL_AND_SHUFFLE"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.ResumeState).toEqual(
|
||||
jasmine.objectContaining({
|
||||
PLAYBACK_START: "PLAYBACK_START",
|
||||
PLAYBACK_PAUSE: "PLAYBACK_PAUSE"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.StreamType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
BUFFERED: "BUFFERED",
|
||||
LIVE: "LIVE",
|
||||
OTHER: "OTHER"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.TextTrackEdgeType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
NONE: "NONE",
|
||||
OUTLINE: "OUTLINE",
|
||||
DROP_SHADOW: "DROP_SHADOW",
|
||||
RAISED: "RAISED",
|
||||
DEPRESSED: "DEPRESSED"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.TextTrackFontGenericFamily).toEqual(
|
||||
jasmine.objectContaining({
|
||||
SANS_SERIF: "SANS_SERIF",
|
||||
MONOSPACED_SANS_SERIF: "MONOSPACED_SANS_SERIF",
|
||||
SERIF: "SERIF",
|
||||
MONOSPACED_SERIF: "MONOSPACED_SERIF",
|
||||
CASUAL: "CASUAL",
|
||||
CURSIVE: "CURSIVE",
|
||||
SMALL_CAPITALS: "SMALL_CAPITALS"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.TextTrackFontStyle).toEqual(
|
||||
jasmine.objectContaining({
|
||||
NORMAL: "NORMAL",
|
||||
BOLD: "BOLD",
|
||||
BOLD_ITALIC: "BOLD_ITALIC",
|
||||
ITALIC: "ITALIC"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.TextTrackType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
SUBTITLES: "SUBTITLES",
|
||||
CAPTIONS: "CAPTIONS",
|
||||
DESCRIPTIONS: "DESCRIPTIONS",
|
||||
CHAPTERS: "CHAPTERS",
|
||||
METADATA: "METADATA"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.TextTrackWindowType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
NONE: "NONE",
|
||||
NORMAL: "NORMAL",
|
||||
ROUNDED_CORNERS: "ROUNDED_CORNERS"
|
||||
})
|
||||
);
|
||||
expect(chrome.cast.media.TrackType).toEqual(
|
||||
jasmine.objectContaining({
|
||||
TEXT: "TEXT",
|
||||
AUDIO: "AUDIO",
|
||||
VIDEO: "VIDEO"
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
describe("chrome.cast.media.timeout", () => {
|
||||
it ("should have all properties", () => {
|
||||
it("should have all properties", () => {
|
||||
expect(chrome.cast.media.timeout.editTracksInfo).toBe(0);
|
||||
expect(chrome.cast.media.timeout.getStatus).toBe(0);
|
||||
expect(chrome.cast.media.timeout.load).toBe(0);
|
||||
@@ -237,7 +285,7 @@ describe("chrome", () => {
|
||||
expect(chrome.cast.media.timeout.seek).toBe(0);
|
||||
expect(chrome.cast.media.timeout.setVolume).toBe(0);
|
||||
expect(chrome.cast.media.timeout.stop).toBe(0);
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.EditTracksInfoRequest", () => {
|
||||
it("should have all properties", async () => {
|
||||
const editTracksInfoRequest = new chrome.cast.media.EditTracksInfoRequest();
|
||||
const editTracksInfoRequest =
|
||||
new chrome.cast.media.EditTracksInfoRequest();
|
||||
|
||||
expect(editTracksInfoRequest.activeTrackIds).toBe(null);
|
||||
expect(editTracksInfoRequest.requestId).toBe(0);
|
||||
@@ -15,14 +16,19 @@ describe("chrome.cast.media.EditTracksInfoRequest", () => {
|
||||
textTrackStyle.fontFamily = "__fontFamily";
|
||||
textTrackStyle.windowRoundedCornerRadius = 5;
|
||||
|
||||
const editTracksInfoRequest = new chrome.cast.media.EditTracksInfoRequest(
|
||||
[ 5, 8, 12 ], textTrackStyle);
|
||||
const editTracksInfoRequest =
|
||||
new chrome.cast.media.EditTracksInfoRequest(
|
||||
[5, 8, 12],
|
||||
textTrackStyle
|
||||
);
|
||||
|
||||
expect(editTracksInfoRequest.activeTrackIds).toEqual([ 5, 8, 12 ]);
|
||||
expect(editTracksInfoRequest.textTrackStyle).toEqual(jasmine.objectContaining({
|
||||
backgroundColor: "#fefefeff"
|
||||
, fontFamily: "__fontFamily"
|
||||
, windowRoundedCornerRadius: 5
|
||||
}));
|
||||
expect(editTracksInfoRequest.activeTrackIds).toEqual([5, 8, 12]);
|
||||
expect(editTracksInfoRequest.textTrackStyle).toEqual(
|
||||
jasmine.objectContaining({
|
||||
backgroundColor: "#fefefeff",
|
||||
fontFamily: "__fontFamily",
|
||||
windowRoundedCornerRadius: 5
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.GenericMediaMetadata", () => {
|
||||
it("should have all properties", async () => {
|
||||
const genericMediaMetadata = new chrome.cast.media.GenericMediaMetadata();
|
||||
const genericMediaMetadata =
|
||||
new chrome.cast.media.GenericMediaMetadata();
|
||||
|
||||
expect(genericMediaMetadata.images).toBe(undefined);
|
||||
expect(genericMediaMetadata.metadataType).toBe(0);
|
||||
|
||||
@@ -16,12 +16,16 @@ describe("chrome.cast.media.LoadRequest", () => {
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const mediaInfo = new chrome.cast.media.MediaInfo(
|
||||
"__contentId", "video/mp4");
|
||||
"__contentId",
|
||||
"video/mp4"
|
||||
);
|
||||
const loadRequest = new chrome.cast.media.LoadRequest(mediaInfo);
|
||||
|
||||
expect(loadRequest.media).toEqual(jasmine.objectContaining({
|
||||
contentId: "__contentId"
|
||||
, contentType: "video/mp4"
|
||||
}));
|
||||
expect(loadRequest.media).toEqual(
|
||||
jasmine.objectContaining({
|
||||
contentId: "__contentId",
|
||||
contentType: "video/mp4"
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,10 +19,12 @@ describe("chrome.cast.media.Media", () => {
|
||||
expect(media.repeatMode).toBe("REPEAT_OFF");
|
||||
expect(media.sessionId).toBe(undefined);
|
||||
expect(media.supportedMediaCommands).toEqual([]);
|
||||
expect(media.volume).toEqual(jasmine.objectContaining({
|
||||
level: null
|
||||
, muted: null
|
||||
}));
|
||||
expect(media.volume).toEqual(
|
||||
jasmine.objectContaining({
|
||||
level: null,
|
||||
muted: null
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
|
||||
@@ -15,7 +15,10 @@ describe("chrome.cast.media.MediaInfo", () => {
|
||||
});
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const mediaInfo = new chrome.cast.media.MediaInfo("__contentId", "video/mp4");
|
||||
const mediaInfo = new chrome.cast.media.MediaInfo(
|
||||
"__contentId",
|
||||
"video/mp4"
|
||||
);
|
||||
|
||||
expect(mediaInfo.contentId).toBe("__contentId");
|
||||
expect(mediaInfo.contentType).toBe("video/mp4");
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.MusicTrackMediaMetadata", () => {
|
||||
it("should have all properties", async () => {
|
||||
const musicTrackMediaMetadata = new chrome.cast.media.MusicTrackMediaMetadata();
|
||||
const musicTrackMediaMetadata =
|
||||
new chrome.cast.media.MusicTrackMediaMetadata();
|
||||
|
||||
expect(musicTrackMediaMetadata.albumArtist).toBe(undefined);
|
||||
expect(musicTrackMediaMetadata.albumName).toBe(undefined);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.QueueInsertItemsRequest", () => {
|
||||
it("should have all properties", async () => {
|
||||
const queueInsertItemsRequest = new chrome.cast.media.QueueInsertItemsRequest();
|
||||
const queueInsertItemsRequest =
|
||||
new chrome.cast.media.QueueInsertItemsRequest();
|
||||
|
||||
expect(queueInsertItemsRequest.customData).toBe(null);
|
||||
expect(queueInsertItemsRequest.insertBefore).toBe(null);
|
||||
@@ -16,20 +17,25 @@ describe("chrome.cast.media.QueueInsertItemsRequest", () => {
|
||||
const media1 = new chrome.cast.media.MediaInfo("media1", "video/mp4");
|
||||
const media2 = new chrome.cast.media.MediaInfo("media2", "audio/mp3");
|
||||
|
||||
const queueInsertItemsRequest = new chrome.cast.media.QueueInsertItemsRequest([
|
||||
new chrome.cast.media.QueueItem(media1)
|
||||
, new chrome.cast.media.QueueItem(media2)
|
||||
]);
|
||||
const queueInsertItemsRequest =
|
||||
new chrome.cast.media.QueueInsertItemsRequest([
|
||||
new chrome.cast.media.QueueItem(media1),
|
||||
new chrome.cast.media.QueueItem(media2)
|
||||
]);
|
||||
|
||||
expect(queueInsertItemsRequest.items).toEqual([
|
||||
jasmine.objectContaining({ media: jasmine.objectContaining({
|
||||
contentId: "media1"
|
||||
, contentType: "video/mp4"
|
||||
})})
|
||||
, jasmine.objectContaining({ media: jasmine.objectContaining({
|
||||
contentId: "media2"
|
||||
, contentType: "audio/mp3"
|
||||
})})
|
||||
jasmine.objectContaining({
|
||||
media: jasmine.objectContaining({
|
||||
contentId: "media1",
|
||||
contentType: "video/mp4"
|
||||
})
|
||||
}),
|
||||
jasmine.objectContaining({
|
||||
media: jasmine.objectContaining({
|
||||
contentId: "media2",
|
||||
contentType: "audio/mp3"
|
||||
})
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,12 +15,17 @@ describe("chrome.cast.media.QueueItem", () => {
|
||||
});
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const media = new chrome.cast.media.MediaInfo("__contentId", "video/mp4");
|
||||
const media = new chrome.cast.media.MediaInfo(
|
||||
"__contentId",
|
||||
"video/mp4"
|
||||
);
|
||||
const queueItem = new chrome.cast.media.QueueItem(media);
|
||||
|
||||
expect(queueItem.media).toEqual(jasmine.objectContaining({
|
||||
contentId: "__contentId"
|
||||
, contentType: "video/mp4"
|
||||
}));
|
||||
expect(queueItem.media).toEqual(
|
||||
jasmine.objectContaining({
|
||||
contentId: "__contentId",
|
||||
contentType: "video/mp4"
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,19 +18,23 @@ describe("chrome.cast.media.QueueLoadRequest", () => {
|
||||
const media2 = new chrome.cast.media.MediaInfo("media2", "audio/mp3");
|
||||
|
||||
const queueLoadRequest = new chrome.cast.media.QueueLoadRequest([
|
||||
new chrome.cast.media.QueueItem(media1)
|
||||
, new chrome.cast.media.QueueItem(media2)
|
||||
new chrome.cast.media.QueueItem(media1),
|
||||
new chrome.cast.media.QueueItem(media2)
|
||||
]);
|
||||
|
||||
expect(queueLoadRequest.items).toEqual([
|
||||
jasmine.objectContaining({ media: jasmine.objectContaining({
|
||||
contentId: "media1"
|
||||
, contentType: "video/mp4"
|
||||
})})
|
||||
, jasmine.objectContaining({ media: jasmine.objectContaining({
|
||||
contentId: "media2"
|
||||
, contentType: "audio/mp3"
|
||||
})})
|
||||
jasmine.objectContaining({
|
||||
media: jasmine.objectContaining({
|
||||
contentId: "media1",
|
||||
contentType: "video/mp4"
|
||||
})
|
||||
}),
|
||||
jasmine.objectContaining({
|
||||
media: jasmine.objectContaining({
|
||||
contentId: "media2",
|
||||
contentType: "audio/mp3"
|
||||
})
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.QueueRemoveItemsRequest", () => {
|
||||
it("should have all properties", async () => {
|
||||
const queueRemoveItemsRequest = new chrome.cast.media.QueueRemoveItemsRequest();
|
||||
const queueRemoveItemsRequest =
|
||||
new chrome.cast.media.QueueRemoveItemsRequest();
|
||||
|
||||
expect(queueRemoveItemsRequest.customData).toBe(null);
|
||||
expect(queueRemoveItemsRequest.itemIds).toBe(undefined);
|
||||
@@ -12,9 +13,9 @@ describe("chrome.cast.media.QueueRemoveItemsRequest", () => {
|
||||
});
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const queueRemoveItemsRequest = new chrome.cast.media.QueueRemoveItemsRequest(
|
||||
[ 5, 8, 12 ]);
|
||||
const queueRemoveItemsRequest =
|
||||
new chrome.cast.media.QueueRemoveItemsRequest([5, 8, 12]);
|
||||
|
||||
expect(queueRemoveItemsRequest.itemIds).toEqual([ 5, 8, 12 ]);
|
||||
expect(queueRemoveItemsRequest.itemIds).toEqual([5, 8, 12]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.QueueReorderItemsRequest", () => {
|
||||
it("should have all properties", async () => {
|
||||
const queueReorderItemsRequest = new chrome.cast.media.QueueReorderItemsRequest();
|
||||
const queueReorderItemsRequest =
|
||||
new chrome.cast.media.QueueReorderItemsRequest();
|
||||
|
||||
expect(queueReorderItemsRequest.customData).toBe(null);
|
||||
expect(queueReorderItemsRequest.insertBefore).toBe(null);
|
||||
@@ -13,9 +14,9 @@ describe("chrome.cast.media.QueueReorderItemsRequest", () => {
|
||||
});
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const queueReorderItemsRequest = new chrome.cast.media.QueueReorderItemsRequest(
|
||||
[ 5, 8, 12 ]);
|
||||
const queueReorderItemsRequest =
|
||||
new chrome.cast.media.QueueReorderItemsRequest([5, 8, 12]);
|
||||
|
||||
expect(queueReorderItemsRequest.itemIds).toEqual([ 5, 8, 12 ]);
|
||||
expect(queueReorderItemsRequest.itemIds).toEqual([5, 8, 12]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.QueueSetPropertiesRequest", () => {
|
||||
it("should have all properties", async () => {
|
||||
const queueSetPropertiesRequest = new chrome.cast.media.QueueSetPropertiesRequest();
|
||||
const queueSetPropertiesRequest =
|
||||
new chrome.cast.media.QueueSetPropertiesRequest();
|
||||
|
||||
expect(queueSetPropertiesRequest.customData).toBe(null);
|
||||
expect(queueSetPropertiesRequest.repeatMode).toBe(null);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
describe("chrome.cast.media.QueueUpdateItemsRequest", () => {
|
||||
it("should have all properties", async () => {
|
||||
const queueUpdateItemsRequest = new chrome.cast.media.QueueUpdateItemsRequest();
|
||||
const queueUpdateItemsRequest =
|
||||
new chrome.cast.media.QueueUpdateItemsRequest();
|
||||
|
||||
expect(queueUpdateItemsRequest.customData).toBe(null);
|
||||
expect(queueUpdateItemsRequest.items).toBe(undefined);
|
||||
@@ -15,20 +16,25 @@ describe("chrome.cast.media.QueueUpdateItemsRequest", () => {
|
||||
const media1 = new chrome.cast.media.MediaInfo("media1", "video/mp4");
|
||||
const media2 = new chrome.cast.media.MediaInfo("media2", "audio/mp3");
|
||||
|
||||
const queueUpdateItemsRequest = new chrome.cast.media.QueueUpdateItemsRequest([
|
||||
new chrome.cast.media.QueueItem(media1)
|
||||
, new chrome.cast.media.QueueItem(media2)
|
||||
]);
|
||||
const queueUpdateItemsRequest =
|
||||
new chrome.cast.media.QueueUpdateItemsRequest([
|
||||
new chrome.cast.media.QueueItem(media1),
|
||||
new chrome.cast.media.QueueItem(media2)
|
||||
]);
|
||||
|
||||
expect(queueUpdateItemsRequest.items).toEqual([
|
||||
jasmine.objectContaining({ media: jasmine.objectContaining({
|
||||
contentId: "media1"
|
||||
, contentType: "video/mp4"
|
||||
})})
|
||||
, jasmine.objectContaining({ media: jasmine.objectContaining({
|
||||
contentId: "media2"
|
||||
, contentType: "audio/mp3"
|
||||
})})
|
||||
jasmine.objectContaining({
|
||||
media: jasmine.objectContaining({
|
||||
contentId: "media1",
|
||||
contentType: "video/mp4"
|
||||
})
|
||||
}),
|
||||
jasmine.objectContaining({
|
||||
media: jasmine.objectContaining({
|
||||
contentId: "media2",
|
||||
contentType: "audio/mp3"
|
||||
})
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,7 +15,10 @@ describe("chrome.cast.media.Track", () => {
|
||||
});
|
||||
|
||||
it("should have expected assigned properties", async () => {
|
||||
const track = new chrome.cast.media.Track(5, chrome.cast.media.TrackType.TEXT);
|
||||
const track = new chrome.cast.media.Track(
|
||||
5,
|
||||
chrome.cast.media.TrackType.TEXT
|
||||
);
|
||||
|
||||
expect(track.trackId).toBe(5);
|
||||
expect(track.type).toBe("TEXT");
|
||||
|
||||
@@ -12,9 +12,11 @@ describe("chrome.cast.media.VolumeRequest", () => {
|
||||
const volume = new chrome.cast.Volume(0.5, false);
|
||||
const volumeRequest = new chrome.cast.media.VolumeRequest(volume);
|
||||
|
||||
expect(volumeRequest.volume).toEqual(jasmine.objectContaining({
|
||||
level: 0.5
|
||||
, muted: false
|
||||
}));
|
||||
expect(volumeRequest.volume).toEqual(
|
||||
jasmine.objectContaining({
|
||||
level: 0.5,
|
||||
muted: false
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user