mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
chrome.cast.media definition tests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ node_modules/
|
|||||||
dist/
|
dist/
|
||||||
app/node_modules/
|
app/node_modules/
|
||||||
ext/node_modules/
|
ext/node_modules/
|
||||||
|
test/ChromeProfile/
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -26,11 +26,10 @@ Only tested on Linux. mDNS library issue to be fixed. `mdns` only works on Windo
|
|||||||
|
|
||||||
### Instructions
|
### Instructions
|
||||||
|
|
||||||
````
|
````sh
|
||||||
git clone https://github.com/hensm/caster.git
|
git clone https://github.com/hensm/caster.git
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build
|
||||||
npm test
|
|
||||||
````
|
````
|
||||||
|
|
||||||
Installer scripts aren't written yet, so registering the native messaging manifest with Firefox and specifiying the path must be done manually:
|
Installer scripts aren't written yet, so registering the native messaging manifest with Firefox and specifiying the path must be done manually:
|
||||||
@@ -39,6 +38,19 @@ Installer scripts aren't written yet, so registering the native messaging manife
|
|||||||
`path` key within `app/caster_bridge.json` must be set to absolute path of `app/src/launcher.sh` or `app/src/launcher.bat`. Then, the manifest must be either moved to the correct location or the path added to the registry (Windows):
|
`path` key within `app/caster_bridge.json` must be set to absolute path of `app/src/launcher.sh` or `app/src/launcher.bat`. Then, the manifest must be either moved to the correct location or the path added to the registry (Windows):
|
||||||
[MDN: Native Manifests # Manifest location](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_manifests#Manifest_location)
|
[MDN: Native Manifests # Manifest location](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_manifests#Manifest_location)
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Testing requires geckodriver (or chromedriver for Chrome parity testing). See [selenium-webdriver](https://www.npmjs.com/package/selenium-webdriver#installation) installation instructions (ignore `npm install`).
|
||||||
|
|
||||||
|
Chrome doesn't load the media router in a temporary selenium profile, so there's a bundled profile (`test/ChromeProfile.zip`). Extract the folder within as `test/ChromeProfile/`.
|
||||||
|
|
||||||
|
````sh
|
||||||
|
npm run build
|
||||||
|
npm test
|
||||||
|
SELENIUM_BROWSER=chrome npm test
|
||||||
|
````
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Extension can be loaded from `about:debugging` as a temporary extension.
|
Extension can be loaded from `about:debugging` as a temporary extension.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
"postinstall:app": "npm install ./app --prefix ./app",
|
"postinstall:app": "npm install ./app --prefix ./app",
|
||||||
"postinstall:ext": "npm install ./ext --prefix ./ext",
|
"postinstall:ext": "npm install ./ext --prefix ./ext",
|
||||||
"build": "npm run build --prefix ./ext",
|
"build": "npm run build --prefix ./ext",
|
||||||
"pretest": "npm run build",
|
|
||||||
"test": "jasmine --config=jasmine.json"
|
"test": "jasmine --config=jasmine.json"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
BIN
test/ChromeProfile.zip
Normal file
BIN
test/ChromeProfile.zip
Normal file
Binary file not shown.
@@ -17,7 +17,7 @@ const firefoxOptions = new firefox.Options()
|
|||||||
const chromeOptions = new chrome.Options()
|
const chromeOptions = new chrome.Options()
|
||||||
.excludeSwitches("disable-default-apps")
|
.excludeSwitches("disable-default-apps")
|
||||||
.addArguments(
|
.addArguments(
|
||||||
"--load-media-router-component-extension");
|
`--user-data-dir=${path.resolve(__dirname, "ChromeProfile")}`);
|
||||||
|
|
||||||
|
|
||||||
async function create () {
|
async function create () {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ describe("chrome", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it("should exist", async () => {
|
it("should exist", () => {
|
||||||
expect(chrome).toBeDefined();
|
expect(chrome).toBeDefined();
|
||||||
expect(chrome.cast).toBeDefined();
|
expect(chrome.cast).toBeDefined();
|
||||||
expect(chrome.cast.media).toBeDefined();
|
expect(chrome.cast.media).toBeDefined();
|
||||||
@@ -22,7 +22,7 @@ describe("chrome", () => {
|
|||||||
|
|
||||||
|
|
||||||
describe("chrome.cast", () => {
|
describe("chrome.cast", () => {
|
||||||
it("should have all api functions", async () => {
|
it("should have all api methods", () => {
|
||||||
expect(chrome.cast.addReceiverActionListener).toBeDefined();
|
expect(chrome.cast.addReceiverActionListener).toBeDefined();
|
||||||
expect(chrome.cast.initialize).toBeDefined();
|
expect(chrome.cast.initialize).toBeDefined();
|
||||||
expect(chrome.cast.logMessage).toBeDefined();
|
expect(chrome.cast.logMessage).toBeDefined();
|
||||||
@@ -36,7 +36,7 @@ describe("chrome", () => {
|
|||||||
expect(chrome.cast.unescape).toBeDefined();
|
expect(chrome.cast.unescape).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should have all api classes", async () => {
|
it("should have all api classes", () => {
|
||||||
expect(chrome.cast.ApiConfig).toBeDefined();
|
expect(chrome.cast.ApiConfig).toBeDefined();
|
||||||
expect(chrome.cast.DialRequest).toBeDefined();
|
expect(chrome.cast.DialRequest).toBeDefined();
|
||||||
expect(chrome.cast.Error).toBeDefined();
|
expect(chrome.cast.Error).toBeDefined();
|
||||||
@@ -50,7 +50,7 @@ describe("chrome", () => {
|
|||||||
expect(chrome.cast.Volume).toBeDefined();
|
expect(chrome.cast.Volume).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should have all api enums", async () => {
|
it("should have all api enums", () => {
|
||||||
expect(chrome.cast.AutoJoinPolicy).toEqual(jasmine.objectContaining({
|
expect(chrome.cast.AutoJoinPolicy).toEqual(jasmine.objectContaining({
|
||||||
CUSTOM_CONTROLLER_SCOPED: "custom_controller_scoped"
|
CUSTOM_CONTROLLER_SCOPED: "custom_controller_scoped"
|
||||||
, TAB_AND_ORIGIN_SCOPED: "tab_and_origin_scoped"
|
, TAB_AND_ORIGIN_SCOPED: "tab_and_origin_scoped"
|
||||||
@@ -128,6 +128,126 @@ describe("chrome", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("chrome.cast.media", () => {
|
describe("chrome.cast.media", () => {
|
||||||
|
it ("should have all api classes", () => {
|
||||||
|
expect(chrome.cast.media.EditTracksInfoRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.GenericMediaMetadata).toBeDefined();
|
||||||
|
expect(chrome.cast.media.GetStatusRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.LoadRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.Media).toBeDefined();
|
||||||
|
expect(chrome.cast.media.MediaInfo).toBeDefined();
|
||||||
|
expect(chrome.cast.media.MovieMediaMetadata).toBeDefined();
|
||||||
|
expect(chrome.cast.media.MusicTrackMediaMetadata).toBeDefined();
|
||||||
|
expect(chrome.cast.media.PauseRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.PhotoMediaMetadata).toBeDefined();
|
||||||
|
expect(chrome.cast.media.PlayRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.QueueInsertItemsRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.QueueItem).toBeDefined();
|
||||||
|
expect(chrome.cast.media.QueueLoadRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.QueueRemoveItemsRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.QueueReorderItemsRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.QueueUpdateItemsRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.SeekRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.StopRequest).toBeDefined();
|
||||||
|
expect(chrome.cast.media.TextTrackStyle).toBeDefined();
|
||||||
|
expect(chrome.cast.media.Track).toBeDefined();
|
||||||
|
expect(chrome.cast.media.TvShowMediaMetadata).toBeDefined();
|
||||||
|
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"
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("chrome.cast.media.timeout", () => {
|
||||||
|
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);
|
||||||
|
expect(chrome.cast.media.timeout.pause).toBe(0);
|
||||||
|
expect(chrome.cast.media.timeout.play).toBe(0);
|
||||||
|
expect(chrome.cast.media.timeout.queue).toBe(0);
|
||||||
|
expect(chrome.cast.media.timeout.seek).toBe(0);
|
||||||
|
expect(chrome.cast.media.timeout.setVolume).toBe(0);
|
||||||
|
expect(chrome.cast.media.timeout.stop).toBe(0);
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user