Best JavaScript code snippet using lambdium
chrome-cast.d.ts
Source:chrome-cast.d.ts
1// Type definitions for Chrome Cast application development2// Project: https://developers.google.com/cast/3// Definitions by: Thomas Stig Jacobsen <https://github.com/eXeDK>4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped5////////////////////6// Cast7// @see https://code.google.com/p/chromium/codesearch#chromium/src/ui/file_manager/externs/chrome_cast.js8////////////////////9declare namespace chrome.cast {10 /**11 * @enum {string}12 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.AutoJoinPolicy13 */14 interface AutoJoinPolicy {15 TAB_AND_ORIGIN_SCOPED: string;16 ORIGIN_SCOPED: string;17 PAGE_SCOPED: string;18 }19 /**20 * @enum {string}21 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.DefaultActionPolicy22 */23 interface DefaultActionPolicy {24 CREATE_SESSION: string;25 CAST_THIS_TAB: string;26 }27 /**28 * @enum {string}29 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Capability30 */31 interface Capability {32 VIDEO_OUT: string;33 AUDIO_OUT: string;34 VIDEO_IN: string;35 AUDIO_IN: string;36 }37 /**38 * @enum {string}39 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ErrorCode40 */41 interface ErrorCode {42 CANCEL: string;43 TIMEOUT: string;44 API_NOT_INITIALIZED: string;45 INVALID_PARAMETER: string;46 EXTENSION_NOT_COMPATIBLE: string;47 EXTENSION_MISSING: string;48 RECEIVER_UNAVAILABLE: string;49 SESSION_ERROR: string;50 CHANNEL_ERROR: string;51 LOAD_MEDIA_FAILED: string;52 }53 /**54 * @enum {string}55 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAvailability56 */57 interface ReceiverAvailability {58 AVAILABLE: string;59 UNAVAILABLE: string;60 }61 /**62 * @enum {string}63 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderPlatform64 */65 interface SenderPlatform {66 CHROME: string;67 IOS: string;68 ANDROID: string;69 }70 /**71 * @enum {string}72 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverType73 */74 interface ReceiverType {75 CAST: string;76 HANGOUT: string;77 CUSTOM: string;78 }79 /**80 * @enum {string}81 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAction82 */83 interface ReceiverAction {84 CAST: string;85 STOP: string;86 }87 /**88 * @enum {string}89 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionStatus90 */91 interface SessionStatus {92 CONNECTED: string;93 DISCONNECTED: string;94 STOPPED: string;95 }96 /**97 * @const {!Array<number>}98 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.VERSION99 */100 var VERSION: Array<number>;101 /**102 * @type {boolean}103 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.isAvailable104 */105 var isAvailable: boolean;106 /**107 * @param {!chrome.cast.ApiConfig} apiConfig108 * @param {function()} successCallback109 * @param {function(chrome.cast.Error)} errorCallback110 */111 export function initialize(112 apiConfig: chrome.cast.ApiConfig,113 successCallback: Function,114 errorCallback: (error: chrome.cast.Error) => void115 ): void;116 /**117 * @param {function(!chrome.cast.Session)} successCallback118 * @param {function(chrome.cast.Error)} errorCallback119 * @param {chrome.cast.SessionRequest=} opt_sessionRequest120 * @param {string=} opt_label121 */122 export function requestSession(123 successCallback: (session: chrome.cast.Session) => void,124 errorCallback: (error: chrome.cast.Error) => void,125 sessionRequest?: chrome.cast.SessionRequest,126 label?: string127 ): void128 /**129 * @param {string} sessionId The id of the session to join.130 */131 export function requestSessionById(132 sessionId: string133 ): void134 /**135 * @param {chrome.cast.ReceiverActionListener} listener136 */137 export function addReceiverActionListener(138 listener: (receiver: chrome.cast.Receiver, receiverAction: chrome.cast.ReceiverAction) => void139 ): void140 /**141 * @param {chrome.cast.ReceiverActionListener} listener142 */143 export function removeReceiverActionListener(144 listener: (receiver: chrome.cast.Receiver, receiverAction: chrome.cast.ReceiverAction) => void145 ): void146 /**147 * @param {string} message The message to log.148 */149 export function logMessage(150 message: string151 ): void152 /**153 * @param {!Array<chrome.cast.Receiver>} receivers154 * @param {function()} successCallback155 * @param {function(chrome.cast.Error)} errorCallback156 */157 export function setCustomReceivers(158 receivers: Array<chrome.cast.Receiver>,159 successCallback: Function,160 errorCallback: (error: chrome.cast.Error) => void161 ): void162 /**163 * @param {!chrome.cast.Receiver} receiver164 * @param {function()} successCallback165 * @param {function(chrome.cast.Error)} errorCallback166 */167 export function setReceiverDisplayStatus(168 receiver: chrome.cast.Receiver,169 successCallback: Function,170 errorCallback: (error: chrome.cast.Error) => void171 ): void172 interface ApiConfig {173 /**174 * @param {!chrome.cast.SessionRequest} sessionRequest175 * @param {function(!chrome.cast.Session)} sessionListener176 * @param {function(!chrome.cast.ReceiverAvailability,Array<Object>)}177 * receiverListener178 * @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy179 * @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy180 * @constructor181 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ApiConfig182 */183 new(184 sessionRequest: chrome.cast.SessionRequest,185 sessionListener: (session: chrome.cast.Session) => void,186 receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void,187 autoJoinPolicy?: chrome.cast.AutoJoinPolicy,188 defaultActionPolicy?: chrome.cast.DefaultActionPolicy189 ):ApiConfig;190 sessionRequest: chrome.cast.SessionRequest;191 sessionListener: (session: chrome.cast.Session) => void;192 receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void;193 autoJoinPolicy?: chrome.cast.AutoJoinPolicy;194 defaultActionPolicy: chrome.cast.DefaultActionPolicy;195 }196 interface Error {197 /**198 * @param {!chrome.cast.ErrorCode} code199 * @param {string=} opt_description200 * @param {Object=} opt_details201 * @constructor202 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error203 */204 new(205 code: chrome.cast.ErrorCode,206 description?: string,207 details?: Object208 ):Error;209 code: chrome.cast.ErrorCode;210 description?: string;211 details?: string;212 }213 interface Image {214 /**215 * @param {string} url216 * @constructor217 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Image218 */219 new(220 url: string221 ):Image;222 url: string;223 height?: number;224 width?: number;225 }226 interface SenderApplication {227 /**228 * @param {!chrome.cast.SenderPlatform} platform229 * @constructor230 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderApplication231 */232 new(233 platform: chrome.cast.SenderPlatform234 ):SenderApplication;235 platform: chrome.cast.SenderPlatform;236 url?: string;237 packageId?: string;238 }239 interface SessionRequest {240 /**241 * @param {string} appId242 * @param {!Array<chrome.cast.Capability>=} opt_capabilities243 * @param {number=} opt_timeout244 * @constructor245 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionRequest246 */247 new(248 appId: string,249 capabilities?: Array<chrome.cast.Capability>,250 timeout?: number251 ):SessionRequest;252 appId: string;253 capabilities: Array<chrome.cast.Capability>;254 requestSessionTimeout: number;255 language?: string;256 }257 interface Session {258 /**259 * @param {string} sessionId260 * @param {string} appId261 * @param {string} displayName262 * @param {!Array<chrome.cast.Image>} appImages263 * @param {!chrome.cast.Receiver} receiver264 * @constructor265 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Session266 */267 new(268 sessionId: string,269 appId: string,270 displayName: string,271 appImages: Array<chrome.cast.Image>,272 receiver: chrome.cast.Receiver273 ):Session;274 sessionId: string;275 appId: string;276 displayName: string;277 appImages: Array<chrome.cast.Image>;278 receiver: chrome.cast.Receiver;279 senderApps: Array<chrome.cast.SenderApplication>;280 namespaces: Array<{name: string}>;281 media: Array<chrome.cast.media.Media>;282 status: chrome.cast.SessionStatus283 /**284 * @param {number} newLevel285 * @param {function()} successCallback286 * @param {function(chrome.cast.Error)} errorCallback287 */288 setReceiverVolumeLevel(289 newLevel: number,290 successCallback: Function,291 errorCallback: (error: chrome.cast.Error) => void292 ):void293 /**294 * @param {boolean} muted295 * @param {function()} successCallback296 * @param {function(chrome.cast.Error)} errorCallback297 */298 setReceiverMuted(299 muted: boolean,300 successCallback: Function,301 errorCallback: (error: chrome.cast.Error) => void302 ):void303 /**304 * @param {function()} successCallback305 * @param {function(chrome.cast.Error)} errorCallback306 */307 leave(308 successCallback: Function,309 errorCallback: (error: chrome.cast.Error) => void310 ):void311 /**312 * @param {function()} successCallback313 * @param {function(chrome.cast.Error)} errorCallback314 */315 stop(316 successCallback: Function,317 errorCallback: (error: chrome.cast.Error) => void318 ):void319 /**320 * @param {string} namespace321 * @param {!Object|string} message322 * @param {!function()} successCallback323 * @param {function(!chrome.cast.Error)} errorCallback324 */325 sendMessage(326 namespace: string,327 message: string,328 successCallback: Function,329 errorCallback: (error: chrome.cast.Error) => void330 ):void331 /**332 * @param {function(boolean)} listener333 */334 addUpdateListener(335 listener: (isAlive:boolean) => void336 ):void337 /**338 * @param {function(boolean)} listener339 */340 removeUpdateListener(341 listener: (isAlive:boolean) => void342 ):void343 /**344 * @param {string} namespace345 * @param {function(string,string)} listener346 */347 addMessageListener(348 namespace: string,349 listener: (namespace: string, message: string) => void350 ):void351 /**352 * @param {string} namespace353 * @param {function(string,string)} listener354 */355 removeMessageListener(356 namespace: string,357 listener: (namespace:string, message:string) => void358 ):void359 /**360 * @param {function(!chrome.cast.media.Media)} listener361 */362 addMediaListener(363 listener: (media: chrome.cast.media.Media) => void364 ):void365 /**366 * @param {function(!chrome.cast.media.Media)} listener367 */368 removeMediaListener(369 listener: (media: chrome.cast.media.Media) => void370 ):void371 /**372 * @param {!chrome.cast.media.LoadRequest} loadRequest373 * @param {function(!chrome.cast.media.Media)} successCallback374 * @param {function(!chrome.cast.Error)} errorCallback375 */376 loadMedia(377 loadRequest: chrome.cast.media.LoadRequest,378 successCallback: (media: chrome.cast.media.Media) => void,379 errorCallback: (error: chrome.cast.Error) => void380 ):void381 /**382 * @param {!chrome.cast.media.QueueLoadRequest} queueLoadRequest383 * @param {function(!chrome.cast.media.Media)} successCallback384 * @param {function(!chrome.cast.Error)} errorCallback385 */386 queueLoad(387 queueLoadRequest: chrome.cast.media.QueueLoadRequest,388 successCallback: (media: chrome.cast.media.Media) => void,389 errorCallback: (error: chrome.cast.Error) => void390 ):void391 }392 interface Receiver {393 /**394 * @param {string} label395 * @param {string} friendlyName396 * @param {Array<chrome.cast.Capability>=} opt_capabilities397 * @param {chrome.cast.Volume=} opt_volume398 * @constructor399 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Receiver400 */401 new(402 label: string,403 friendlyName: string,404 capabilities?: Array<chrome.cast.Capability>,405 volume?: chrome.cast.Volume406 ):Receiver;407 label: string;408 friendlyName: string;409 capabilities: Array<chrome.cast.Capability>;410 volume: chrome.cast.Volume;411 receiverType: chrome.cast.ReceiverType;412 displayStatus: chrome.cast.ReceiverDisplayStatus;413 }414 interface ReceiverDisplayStatus {415 /**416 * @param {string} statusText417 * @param {!Array<chrome.cast.Image>} appImages418 * @constructor419 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverDisplayStatus420 */421 new(422 statusText: string,423 appImages: Array<chrome.cast.Image>424 ):ReceiverDisplayStatus;425 statusText: string;426 appImages: Array<chrome.cast.Image>;427 }428 interface Volume {429 /**430 * @param {?number=} opt_level431 * @param {?boolean=} opt_muted432 * @constructor433 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Volume434 */435 new(436 level?: number,437 muted?: boolean438 ):Volume;439 level?: number;440 muted?: boolean;441 }442}443declare namespace chrome.cast.media {444 var DEFAULT_MEDIA_RECEIVER_APP_ID: string;445 /**446 * @enum {string}447 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaCommand448 */449 interface MediaCommand {450 PAUSE: string;451 SEEK: string;452 STREAM_VOLUME: string;453 STREAM_MUTE: string;454 }455 /**456 * @enum {number}457 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MetadataType458 */459 interface MetadataType {460 GENERIC: number;461 TV_SHOW: number;462 MOVIE: number;463 MUSIC_TRACK: number;464 PHOTO: number;465 }466 /**467 * @enum {string}468 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayerState469 */470 interface PlayerState {471 IDLE: string;472 PLAYING: string;473 PAUSED: string;474 BUFFERING: string;475 }476 /**477 * @enum {string}478 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.ResumeState479 */480 interface ResumeState {481 PLAYBACK_START: string;482 PLAYBACK_PAUSE: string;483 }484 /**485 * @enum {string}486 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StreamType487 */488 interface StreamType {489 BUFFERED: string;490 LIVE: string;491 OTHER: string;492 }493 /**494 * @enum {string}495 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.IdleReason496 */497 interface IdleReason {498 CANCELLED: string;499 INTERRUPTED: string;500 FINISHED: string;501 ERROR: string;502 }503 /**504 * @enum {string}505 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode506 */507 interface RepeatMode {508 OFF:string;509 ALL:string;510 SINGLE:string;511 ALL_AND_SHUFFLE:string;512 }513 interface QueueItem {514 /**515 * @param {!chrome.cast.media.MediaInfo} mediaInfo516 * @constructor517 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem518 */519 new(520 mediaInfo: chrome.cast.media.MediaInfo521 ):QueueItem;522 activeTrackIds: Array<Number>;523 autoplay: boolean;524 customData: Object;525 itemId: number;526 media: chrome.cast.media.MediaInfo;527 preloadTime: number;528 startTime: number;529 }530 interface QueueLoadRequest {531 /**532 * @param {!Array<chrome.cast.media.QueueItem>} items533 * @constructor534 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest535 */536 new(537 items: Array<chrome.cast.media.QueueItem>538 ):QueueLoadRequest;539 customData: Object;540 items: Array<chrome.cast.media.QueueItem>;541 repeatMode: chrome.cast.media.RepeatMode;542 startIndex: number;543 }544 interface QueueInsertItemsRequest {545 /**546 * @param {!Array<chrome.cast.media.QueueItem>}547 * @constructor548 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest549 */550 new(551 itemsToInsert: Array<chrome.cast.media.QueueItem>552 ):QueueInsertItemsRequest;553 customData: Object;554 insertBefore:number;555 items: Array<chrome.cast.media.QueueItem>;556 }557 interface QueueRemoveItemsRequest {558 /**559 * @param {!Array<number>}560 * @constructor561 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest562 */563 new(564 itemIdsToRemove: Array<number>565 ):QueueRemoveItemsRequest;566 customData: Object;567 itemIds: Array<number>;568 }569 interface QueueReorderItemsRequest {570 /**571 * @param {!Array<number>}572 * @constructor573 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest574 */575 new(576 itemIdsToReorder: Array<number>577 ):QueueReorderItemsRequest;578 customData: Object;579 insertBefore: number;580 itemIds: Array<number>;581 }582 interface QueueUpdateItemsRequest {583 /**584 * @param {!Array<chrome.cast.media.QueueItem>}585 * @constructor586 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest587 */588 new(589 itemsToUpdate: Array<chrome.cast.media.QueueItem>590 ):QueueUpdateItemsRequest;591 customData: Object;592 item: Array<chrome.cast.media.QueueItem>;593 }594 /**595 * @enum {string}596 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TrackType597 */598 interface TrackType {599 TEXT: string;600 AUDIO: string;601 VIDEO: string;602 }603 /**604 * @enum {string}605 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackType606 */607 interface TextTrackType {608 SUBTITLES: string;609 CAPTIONS: string;610 DESCRIPTIONS: string;611 CHAPTERS: string;612 METADATA: string;613 }614 /**615 * @enum {string}616 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackEdgeType617 */618 interface TextTrackEdgeType {619 NONE: string;620 OUTLINE: string;621 DROP_SHADOW: string;622 RAISED: string;623 DEPRESSED: string;624 }625 /**626 * @enum {string}627 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackWindowType628 */629 interface TextTrackWindowType {630 NONE: string;631 NORMAL: string;632 ROUNDED_CORNERS: string;633 }634 /**635 * @enum {string}636 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontGenericFamily637 */638 interface TextTrackFontGenericFamily {639 SANS_SERIF: string;640 MONOSPACED_SANS_SERIF: string;641 SERIF: string;642 MONOSPACED_SERIF: string;643 CASUAL: string;644 CURSIVE: string;645 SMALL_CAPITALS: string;646 }647 /**648 * @enum {string}649 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontStyle650 */651 interface TextTrackFontStyle {652 NORMAL: string;653 BOLD: string;654 BOLD_ITALIC: string;655 ITALIC: string;656 }657 interface GetStatusRequest {658 /**659 * @constructor660 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest661 */662 new():GetStatusRequest;663 customData: Object;664 }665 interface PauseRequest {666 /**667 * @constructor668 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest669 */670 new():PauseRequest;671 customData: Object;672 }673 interface PlayRequest {674 /**675 * @constructor676 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest677 */678 new():PlayRequest;679 customData: Object;680 }681 interface SeekRequest {682 /**683 * @constructor684 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest685 */686 new():SeekRequest;687 currentTime: number;688 resumeState: chrome.cast.media.ResumeState;689 customData: Object;690 }691 interface StopRequest {692 /**693 * @constructor694 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest695 */696 new():StopRequest;697 customData: Object;698 }699 interface VolumeRequest {700 /**701 * @param {!chrome.cast.Volume} volume702 * @constructor703 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.VolumeRequest704 */705 new(706 volume: chrome.cast.Volume707 ):VolumeRequest;708 volume: chrome.cast.Volume;709 customData: Object;710 }711 interface LoadRequest {712 /**713 * @param {!chrome.cast.media.MediaInfo} mediaInfo714 * @constructor715 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LoadRequest716 */717 new(718 mediaInfo: chrome.cast.media.MediaInfo719 ):LoadRequest;720 activeTrackIds: Array<number>;721 autoplay: boolean;722 currentTime: number;723 customData: Object;724 media: chrome.cast.media.MediaInfo;725 }726 interface EditTracksInfoRequest {727 /**728 * @param {Array<number>=} opt_activeTrackIds729 * @param {chrome.cast.media.TextTrackStyle=} opt_textTrackStyle730 * @constructor731 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.EditTracksInfoRequest732 */733 new(734 activeTrackIds?: Array<number>,735 textTrackStyle?: chrome.cast.media.TextTrackStyle736 ):EditTracksInfoRequest;737 activeTrackIds: Array<number>;738 textTrackStyle: chrome.cast.media.TextTrackStyle;739 }740 interface GenericMediaMetadata {741 /**742 * @constructor743 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata744 */745 new():GenericMediaMetadata;746 images: Array<chrome.cast.Image>;747 metadataType: chrome.cast.media.MetadataType;748 releaseDate: string;749 /** @deprecated. Use releaseDate instead. */750 releaseYear: number;751 subtitle: string;752 title: string;753 /** @deprecated. Use metadataType instead. */754 type: chrome.cast.media.MetadataType;755 }756 interface MovieMediaMetadata {757 /**758 * @constructor759 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata760 */761 new():MovieMediaMetadata;762 images: Array<chrome.cast.Image>;763 metadataType: chrome.cast.media.MetadataType;764 releaseDate: string;765 /** @deprecated. Use releaseDate instead. */766 releaseYear: number;767 subtitle: string;768 title: string;769 studio: string;770 /** @deprecated. Use metadataType instead. */771 type: chrome.cast.media.MetadataType;772 }773 interface TvShowMediaMetadata {774 /**775 * @constructor776 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata777 */778 new(): TvShowMediaMetadata;779 metadataType: chrome.cast.media.MetadataType;780 seriesTitle: string;781 title: string;782 season: number;783 episode: number;784 images: Array<chrome.cast.Image>;785 originalAirdate: string;786 /** @deprecated. Use metadataType instead. */787 type: chrome.cast.media.MetadataType;788 /** @deprecated. Use title instead. */789 episodeTitle: string;790 /** @deprecated. Use season instead. */791 seasonNumber: number;792 /** @deprecated. Use episode instead. */793 episodeNumber: number;794 /** @deprecated. Use originalAirdate instead. */795 releaseYear: number;796 }797 interface MusicTrackMediaMetadata {798 /**799 * @constructor800 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata801 */802 new(): MusicTrackMediaMetadata;803 metadataType: chrome.cast.media.MetadataType;804 albumName: string;805 title: string;806 albumArtist: string;807 artist: string;808 composer: string;809 songName: string;810 trackNumber: number;811 discNumber: number;812 images: Array<chrome.cast.Image>;813 releaseDate: string;814 /** @deprecated. Use metadataType instead. */815 type: chrome.cast.media.MetadataType;816 /** @deprecated. Use artist instead. */817 artistName: string;818 /** @deprecated. Use releaseDate instead. */819 releaseYear: number;820 }821 interface PhotoMediaMetadata {822 /**823 * @constructor824 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata825 */826 new(): PhotoMediaMetadata;827 metadataType: chrome.cast.media.MetadataType;828 title: string;829 artist: string;830 location: string;831 images: Array<chrome.cast.Image>;832 latitude: number;833 longitude: number;834 width: number;835 height: number;836 creationDateTime: string;837 /** @deprecated. Use metadataType instead. */838 type: chrome.cast.media.MetadataType;839 }840 interface MediaInfo {841 /**842 * @param {string} contentId843 * @param {string} contentType844 * @constructor845 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaInfo846 */847 new(848 contentId: string,849 contentType: string850 ): MediaInfo;851 contentId: string;852 streamType: chrome.cast.media.StreamType;853 contentType: string;854 metadata: Object;855 duration: number;856 tracks: Array<chrome.cast.media.Track>;857 textTrackStyle: chrome.cast.media.TextTrackStyle;858 customData: Object;859 }860 interface Media {861 /**862 * @param {string} sessionId863 * @param {number} mediaSessionId864 * @constructor865 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Media866 */867 new(868 sessionId: string,869 mediaSessionId: number870 ): Media;871 activeTrackIds: Array<number>;872 currentItemId: number;873 customData: Object;874 idleReason: chrome.cast.media.IdleReason;875 items: Array<chrome.cast.media.QueueItem>;876 loadingItemId: number;877 media: chrome.cast.media.MediaInfo;878 mediaSessionId: number;879 playbackRate: number;880 playerState: chrome.cast.media.PlayerState;881 preloadedItemId: number;882 repeatMode: chrome.cast.media.RepeatMode;883 sessionId: string;884 supportedMediaCommands: Array<chrome.cast.media.MediaCommand>;885 volume: chrome.cast.Volume;886 /** @deprecated. Use getEstimatedTime instead */887 currentTime: number;888 /**889 * @param {chrome.cast.media.GetStatusRequest} getStatusRequest890 * @param {function()} successCallback891 * @param {function(!chrome.cast.Error)} errorCallback892 */893 getStatus(894 getStatusRequest: chrome.cast.media.GetStatusRequest,895 successCallback: Function,896 errorCallback: (error: chrome.cast.Error) => void897 ): void898 /**899 * @param {chrome.cast.media.PlayRequest} playRequest900 * @param {function()} successCallback901 * @param {function(!chrome.cast.Error)} errorCallback902 */903 play(904 playRequest: chrome.cast.media.PlayRequest,905 successCallback: Function,906 errorCallback: (error: chrome.cast.Error) => void907 ): void908 /**909 * @param {chrome.cast.media.PauseRequest} pauseRequest910 * @param {function()} successCallback911 * @param {function(!chrome.cast.Error)} errorCallback912 */913 pause(914 pauseRequest: chrome.cast.media.PauseRequest,915 successCallback: Function,916 errorCallback: (error: chrome.cast.Error) => void917 ): void918 /**919 * @param {!chrome.cast.media.SeekRequest} seekRequest920 * @param {function()} successCallback921 * @param {function(!chrome.cast.Error)} errorCallback922 */923 seek(924 seekRequest: chrome.cast.media.SeekRequest,925 successCallback: Function,926 errorCallback: (error: chrome.cast.Error) => void927 ): void928 /**929 * @param {chrome.cast.media.StopRequest} stopRequest930 * @param {function()} successCallback931 * @param {function(!chrome.cast.Error)} errorCallback932 */933 stop(934 stopRequest: chrome.cast.media.StopRequest,935 successCallback: Function,936 errorCallback: (error: chrome.cast.Error) => void937 ): void938 /**939 * @param {!chrome.cast.media.VolumeRequest} volumeRequest940 * @param {function()} successCallback941 * @param {function(!chrome.cast.Error)} errorCallback942 */943 setVolume(944 volumeRequest: chrome.cast.media.VolumeRequest,945 successCallback: Function,946 errorCallback: (error: chrome.cast.Error) => void947 ): void948 /**949 * @param {!chrome.cast.media.EditTracksInfoRequest} editTracksInfoRequest950 * @param {function()} successCallback951 * @param {function(!chrome.cast.Error)} errorCallback952 */953 editTracksInfo(954 editTracksInfoRequest: chrome.cast.media.EditTracksInfoRequest,955 successCallback: Function,956 errorCallback: (error: chrome.cast.Error) => void957 ): void958 /**959 * @param {!chrome.cast.media.MediaCommand} command960 * @return {boolean}961 */962 supportsCommand(963 command: chrome.cast.media.MediaCommand964 ): boolean965 /**966 * @param {function(boolean)} listener967 */968 addUpdateListener(969 listener: (isAlive:boolean) => void970 ): void971 /**972 * @param {function(boolean)} listener973 */974 removeUpdateListener(975 listener: (isAlive:boolean) => void976 ): void977 /**978 * @return {number}979 * @suppress {deprecated} Uses currentTime member to compute estimated time.980 */981 getEstimatedTime(): number982 /**983 * @param {!chrome.cast.media.QueueItem} item984 * @param {function()} successCallback985 * @param {function(!chrome.cast.Error)} errorCallback986 */987 queueAppendItem (988 item: chrome.cast.media.QueueItem,989 successCallback: Function,990 errorCallback: (error: chrome.cast.Error) => void991 ): void992 /**993 * @param {!chrome.cast.media.QueueInsertItemsRequest} queueInsertItemsRequest994 * @param {function()} successCallback995 * @param {function(!chrome.cast.Error)} errorCallback996 */997 queueInsertItems (998 queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest,999 successCallback: Function,1000 errorCallback: (error: chrome.cast.Error) => void1001 ): void1002 /**1003 * @param {!number} itemId1004 * @param {function()} successCallback1005 * @param {function(!chrome.cast.Error)} errorCallback1006 */1007 queueJumpToItem (1008 itemId: number,1009 successCallback: Function,1010 errorCallback: (error: chrome.cast.Error) => void1011 ): void1012 /**1013 * @param {!number} itemId1014 * @param {!number} newIndex1015 * @param {function()} successCallback1016 * @param {function(!chrome.cast.Error)} errorCallback1017 */1018 queueMoveItemToNewIndex (1019 itemId: number,1020 newIndex: number,1021 successCallback: Function,1022 errorCallback: (error: chrome.cast.Error) => void1023 ): void1024 /**1025 * @param {function()} successCallback1026 * @param {function(!chrome.cast.Error)} errorCallback1027 */1028 queueNext (1029 successCallback: Function,1030 errorCallback: (error: chrome.cast.Error) => void1031 ): void1032 /**1033 * @param {function()} successCallback1034 * @param {function(!chrome.cast.Error)} errorCallback1035 */1036 queuePrev (1037 successCallback: Function,1038 errorCallback: (error: chrome.cast.Error) => void1039 ): void1040 /**1041 * @param {!number} itemId1042 * @param {function()} successCallback1043 * @param {function(!chrome.cast.Error)} errorCallback1044 */1045 queueRemoveItem (1046 itemId: number,1047 successCallback: Function,1048 errorCallback: (error: chrome.cast.Error) => void1049 ): void1050 /**1051 * @param {!chrome.cast.media.QueueReorderItemsRequest} queueReorderItemsRequest1052 * @param {function()} successCallback1053 * @param {function(!chrome.cast.Error)} errorCallback1054 */1055 queueReorderItems (1056 queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest,1057 successCallback: Function,1058 errorCallback: (error: chrome.cast.Error) => void1059 ): void1060 /**1061 * @param {!chrome.cast.media.RepeatMode} repeatMode1062 * @param {function()} successCallback1063 * @param {function(!chrome.cast.Error)} errorCallback1064 */1065 queueSetRepeatMode (1066 repeatMode: chrome.cast.media.RepeatMode,1067 successCallback: Function,1068 errorCallback: (error: chrome.cast.Error) => void1069 ): void1070 /**1071 * @param {!chrome.cast.media.QueueUpdateItemsRequest} queueUpdateItemsRequest1072 * @param {function()} successCallback1073 * @param {function(!chrome.cast.Error)} errorCallback1074 */1075 queueUpdateItems (1076 queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest,1077 successCallback: Function,1078 errorCallback: (error: chrome.cast.Error) => void1079 ): void1080 }1081 interface Track {1082 /**1083 * @param {number} trackId1084 * @param {!chrome.cast.media.TrackType} trackType1085 * @constructor1086 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Track1087 */1088 new(1089 trackId: number,1090 trackType: chrome.cast.media.TrackType1091 ): Track;1092 trackId: number;1093 trackContentId: string;1094 trackContentType: string;1095 type: chrome.cast.media.TrackType;1096 name: string;1097 language: string;1098 subtype: chrome.cast.media.TextTrackType;1099 customData: Object;1100 }1101 interface TextTrackStyle {1102 /**1103 * @constructor1104 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle1105 */1106 new(): TextTrackStyle;1107 foregroundColor: string;1108 backgroundColor: string;1109 edgeType: chrome.cast.media.TextTrackEdgeType;1110 edgeColor: string;1111 windowType: chrome.cast.media.TextTrackWindowType;1112 windowColor: string;1113 windowRoundedCornerRadius: number;1114 fontScale: number;1115 fontFamily: string;1116 fontGenericFamily: chrome.cast.media.TextTrackFontGenericFamily;1117 fontStyle: chrome.cast.media.TextTrackFontStyle;1118 customData: Object;1119 }1120}1121/**1122 * @namespace1123 * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.timeout1124 */1125declare namespace chrome.cast.media.timeout {1126 var load: number;1127 var getStatus: number;1128 var play: number;1129 var pause: number;1130 var seek: number;1131 var stop: number;1132 var setVolume: number;1133 var editTracksInfo: number;1134 var queueInsert: number;1135 var queueLoad: number;1136 var queueRemove: number;1137 var queueReorder: number;1138 var queueUpdate: number;...
chrome_trace_category_filter_unittest.py
Source:chrome_trace_category_filter_unittest.py
1# Copyright 2014 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4import unittest5from telemetry.timeline import chrome_trace_category_filter6class ChromeTraceCategoryFilterTest(unittest.TestCase):7 def CheckBasicCategoryFilters(self, cf):8 self.assertEquals(set(['x']), set(cf.included_categories))9 self.assertEquals(set(['y']), set(cf.excluded_categories))10 self.assertEquals(set(['disabled-by-default-z']),11 set(cf.disabled_by_default_categories))12 self.assertEquals(set(['DELAY(7;foo)']), set(cf.synthetic_delays))13 self.assertTrue('x' in cf.filter_string)14 self.assertEquals(15 'x,disabled-by-default-z,-y,DELAY(7;foo)',16 cf.stable_filter_string)17 def testBasic(self):18 cf = chrome_trace_category_filter.ChromeTraceCategoryFilter(19 'x,-y,disabled-by-default-z,DELAY(7;foo)')20 self.CheckBasicCategoryFilters(cf)21 def testBasicWithSpace(self):22 cf = chrome_trace_category_filter.ChromeTraceCategoryFilter(23 ' x ,\n-y\t,disabled-by-default-z ,DELAY(7;foo)')24 self.CheckBasicCategoryFilters(cf)25 def testNoneAndEmptyCategory(self):26 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()27 self.assertEquals(a.stable_filter_string, '')28 self.assertEquals(a.filter_string, '')29 self.assertEquals(str(a.GetDictForChromeTracing()), '{}')30 # Initializing chrome trace category filter with empty string is the same31 # as initialization with None.32 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(filter_string='')33 self.assertEquals(b.stable_filter_string, '')34 self.assertEquals(b.filter_string, '')35 self.assertEquals(str(b.GetDictForChromeTracing()), '{}')36 def testAddIncludedCategory(self):37 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()38 a.AddIncludedCategory('foo')39 a.AddIncludedCategory('bar')40 a.AddIncludedCategory('foo')41 self.assertEquals(a.stable_filter_string, 'bar,foo')42 def testAddExcludedCategory(self):43 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()44 a.AddExcludedCategory('foo')45 a.AddExcludedCategory('bar')46 a.AddExcludedCategory('foo')47 self.assertEquals(a.stable_filter_string, '-bar,-foo')48 def testIncludeAndExcludeCategoryRaisesAssertion(self):49 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()50 a.AddIncludedCategory('foo')51 self.assertRaises(AssertionError, a.AddExcludedCategory, 'foo')52 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()53 a.AddExcludedCategory('foo')54 self.assertRaises(AssertionError, a.AddIncludedCategory, 'foo')55 self.assertRaises(AssertionError,56 chrome_trace_category_filter.ChromeTraceCategoryFilter,57 'foo,-foo')58 self.assertRaises(AssertionError,59 chrome_trace_category_filter.ChromeTraceCategoryFilter,60 '-foo,foo')61 def testIsSubset(self):62 b = chrome_trace_category_filter.ChromeTraceCategoryFilter()63 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()64 self.assertEquals(a.IsSubset(b), True)65 b = chrome_trace_category_filter.ChromeTraceCategoryFilter()66 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("test1,test2")67 self.assertEquals(a.IsSubset(b), True)68 b = chrome_trace_category_filter.ChromeTraceCategoryFilter()69 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("-test1,-test2")70 self.assertEquals(a.IsSubset(b), True)71 b = chrome_trace_category_filter.ChromeTraceCategoryFilter("test1,test2")72 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()73 self.assertEquals(a.IsSubset(b), None)74 b = chrome_trace_category_filter.ChromeTraceCategoryFilter()75 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("test*")76 self.assertEquals(a.IsSubset(b), None)77 b = chrome_trace_category_filter.ChromeTraceCategoryFilter("test?")78 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()79 self.assertEquals(a.IsSubset(b), None)80 b = chrome_trace_category_filter.ChromeTraceCategoryFilter("test1")81 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("test1,test2")82 self.assertEquals(a.IsSubset(b), False)83 b = chrome_trace_category_filter.ChromeTraceCategoryFilter("-test1")84 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("test1")85 self.assertEquals(a.IsSubset(b), False)86 b = chrome_trace_category_filter.ChromeTraceCategoryFilter("test1,test2")87 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("test2,test1")88 self.assertEquals(a.IsSubset(b), True)89 b = chrome_trace_category_filter.ChromeTraceCategoryFilter("-test1,-test2")90 a = chrome_trace_category_filter.ChromeTraceCategoryFilter("-test2")91 self.assertEquals(a.IsSubset(b), False)92 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(93 "disabled-by-default-test1")94 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(95 "disabled-by-default-test1,disabled-by-default-test2")96 self.assertEquals(a.IsSubset(b), False)97 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(98 "disabled-by-default-test1")99 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(100 "disabled-by-default-test2")101 self.assertEquals(a.IsSubset(b), False)102 def testIsSubsetWithSyntheticDelays(self):103 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(104 "DELAY(foo;0.016)")105 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(106 "DELAY(foo;0.016)")107 self.assertEquals(a.IsSubset(b), True)108 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(109 "DELAY(foo;0.016)")110 a = chrome_trace_category_filter.ChromeTraceCategoryFilter()111 self.assertEquals(a.IsSubset(b), True)112 b = chrome_trace_category_filter.ChromeTraceCategoryFilter()113 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(114 "DELAY(foo;0.016)")115 self.assertEquals(a.IsSubset(b), False)116 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(117 "DELAY(foo;0.016)")118 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(119 "DELAY(foo;0.032)")120 self.assertEquals(a.IsSubset(b), False)121 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(122 "DELAY(foo;0.016;static)")123 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(124 "DELAY(foo;0.016;oneshot)")125 self.assertEquals(a.IsSubset(b), False)126 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(127 "DELAY(foo;0.016),DELAY(bar;0.1)")128 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(129 "DELAY(bar;0.1),DELAY(foo;0.016)")130 self.assertEquals(a.IsSubset(b), True)131 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(132 "DELAY(foo;0.016),DELAY(bar;0.1)")133 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(134 "DELAY(bar;0.1)")135 self.assertEquals(a.IsSubset(b), True)136 b = chrome_trace_category_filter.ChromeTraceCategoryFilter(137 "DELAY(foo;0.016),DELAY(bar;0.1)")138 a = chrome_trace_category_filter.ChromeTraceCategoryFilter(139 "DELAY(foo;0.032),DELAY(bar;0.1)")...
test_packager_l10n.py
Source:test_packager_l10n.py
1# This Source Code Form is subject to the terms of the Mozilla Public2# License, v. 2.0. If a copy of the MPL was not distributed with this3# file, You can obtain one at http://mozilla.org/MPL/2.0/.4import unittest5import mozunit6from test_packager import MockFinder7from mozpack.packager import l10n8from mozpack.files import (9 GeneratedFile,10 ManifestFile,11)12from mozpack.chrome.manifest import (13 Manifest,14 ManifestLocale,15 ManifestContent,16)17from mozpack.copier import FileRegistry18from mozpack.packager.formats import FlatFormatter19class TestL10NRepack(unittest.TestCase):20 def test_l10n_repack(self):21 foo = GeneratedFile('foo')22 foobar = GeneratedFile('foobar')23 qux = GeneratedFile('qux')24 bar = GeneratedFile('bar')25 baz = GeneratedFile('baz')26 dict_aa = GeneratedFile('dict_aa')27 dict_bb = GeneratedFile('dict_bb')28 dict_cc = GeneratedFile('dict_cc')29 barbaz = GeneratedFile('barbaz')30 lst = GeneratedFile('foo\nbar')31 app_finder = MockFinder({32 'bar/foo': foo,33 'chrome/foo/foobar': foobar,34 'chrome/qux/qux.properties': qux,35 'chrome/qux/baz/baz.properties': baz,36 'chrome/chrome.manifest': ManifestFile('chrome', [37 ManifestContent('chrome', 'foo', 'foo/'),38 ManifestLocale('chrome', 'qux', 'en-US', 'qux/'),39 ]),40 'chrome.manifest':41 ManifestFile('', [Manifest('', 'chrome/chrome.manifest')]),42 'dict/aa': dict_aa,43 'app/chrome/bar/barbaz.dtd': barbaz,44 'app/chrome/chrome.manifest': ManifestFile('app/chrome', [45 ManifestLocale('app/chrome', 'bar', 'en-US', 'bar/')46 ]),47 'app/chrome.manifest':48 ManifestFile('app', [Manifest('app', 'chrome/chrome.manifest')]),49 'app/dict/bb': dict_bb,50 'app/dict/cc': dict_cc,51 'app/chrome/bar/search/foo.xml': foo,52 'app/chrome/bar/search/bar.xml': bar,53 'app/chrome/bar/search/lst.txt': lst,54 })55 app_finder.jarlogs = {}56 app_finder.base = 'app'57 foo_l10n = GeneratedFile('foo_l10n')58 qux_l10n = GeneratedFile('qux_l10n')59 baz_l10n = GeneratedFile('baz_l10n')60 barbaz_l10n = GeneratedFile('barbaz_l10n')61 lst_l10n = GeneratedFile('foo\nqux')62 l10n_finder = MockFinder({63 'chrome/qux-l10n/qux.properties': qux_l10n,64 'chrome/qux-l10n/baz/baz.properties': baz_l10n,65 'chrome/chrome.manifest': ManifestFile('chrome', [66 ManifestLocale('chrome', 'qux', 'x-test', 'qux-l10n/'),67 ]),68 'chrome.manifest':69 ManifestFile('', [Manifest('', 'chrome/chrome.manifest')]),70 'dict/bb': dict_bb,71 'dict/cc': dict_cc,72 'app/chrome/bar-l10n/barbaz.dtd': barbaz_l10n,73 'app/chrome/chrome.manifest': ManifestFile('app/chrome', [74 ManifestLocale('app/chrome', 'bar', 'x-test', 'bar-l10n/')75 ]),76 'app/chrome.manifest':77 ManifestFile('app', [Manifest('app', 'chrome/chrome.manifest')]),78 'app/dict/aa': dict_aa,79 'app/chrome/bar-l10n/search/foo.xml': foo_l10n,80 'app/chrome/bar-l10n/search/qux.xml': qux_l10n,81 'app/chrome/bar-l10n/search/lst.txt': lst_l10n,82 })83 l10n_finder.base = 'l10n'84 copier = FileRegistry()85 formatter = FlatFormatter(copier)86 l10n._repack(app_finder, l10n_finder, copier, formatter,87 ['dict', 'chrome/**/search/*.xml'])88 self.maxDiff = None89 repacked = {90 'bar/foo': foo,91 'chrome/foo/foobar': foobar,92 'chrome/qux-l10n/qux.properties': qux_l10n,93 'chrome/qux-l10n/baz/baz.properties': baz_l10n,94 'chrome/chrome.manifest': ManifestFile('chrome', [95 ManifestContent('chrome', 'foo', 'foo/'),96 ManifestLocale('chrome', 'qux', 'x-test', 'qux-l10n/'),97 ]),98 'chrome.manifest':99 ManifestFile('', [Manifest('', 'chrome/chrome.manifest')]),100 'dict/bb': dict_bb,101 'dict/cc': dict_cc,102 'app/chrome/bar-l10n/barbaz.dtd': barbaz_l10n,103 'app/chrome/chrome.manifest': ManifestFile('app/chrome', [104 ManifestLocale('app/chrome', 'bar', 'x-test', 'bar-l10n/')105 ]),106 'app/chrome.manifest':107 ManifestFile('app', [Manifest('app', 'chrome/chrome.manifest')]),108 'app/dict/aa': dict_aa,109 'app/chrome/bar-l10n/search/foo.xml': foo_l10n,110 'app/chrome/bar-l10n/search/qux.xml': qux_l10n,111 'app/chrome/bar-l10n/search/lst.txt': lst_l10n,112 }113 self.assertEqual(114 dict((p, f.open().read()) for p, f in copier),115 dict((p, f.open().read()) for p, f in repacked.iteritems())116 )117if __name__ == '__main__':...
theme-chrome.js
Source:theme-chrome.js
1define("ace/theme/chrome",["require","exports","module","ace/lib/dom"], function(require, exports, module) {2exports.isDark = false;3exports.cssClass = "ace-chrome";4exports.cssText = ".ace-chrome .ace_gutter {\5background: #ebebeb;\6color: #333;\7overflow : hidden;\8}\9.ace-chrome .ace_print-margin {\10width: 1px;\11background: #e8e8e8;\12}\13.ace-chrome {\14background-color: #FFFFFF;\15color: black;\16}\17.ace-chrome .ace_cursor {\18color: black;\19}\20.ace-chrome .ace_invisible {\21color: rgb(191, 191, 191);\22}\23.ace-chrome .ace_constant.ace_buildin {\24color: rgb(88, 72, 246);\25}\26.ace-chrome .ace_constant.ace_language {\27color: rgb(88, 92, 246);\28}\29.ace-chrome .ace_constant.ace_library {\30color: rgb(6, 150, 14);\31}\32.ace-chrome .ace_invalid {\33background-color: rgb(153, 0, 0);\34color: white;\35}\36.ace-chrome .ace_fold {\37}\38.ace-chrome .ace_support.ace_function {\39color: rgb(60, 76, 114);\40}\41.ace-chrome .ace_support.ace_constant {\42color: rgb(6, 150, 14);\43}\44.ace-chrome .ace_support.ace_type,\45.ace-chrome .ace_support.ace_class\46.ace-chrome .ace_support.ace_other {\47color: rgb(109, 121, 222);\48}\49.ace-chrome .ace_variable.ace_parameter {\50font-style:italic;\51color:#FD971F;\52}\53.ace-chrome .ace_keyword.ace_operator {\54color: rgb(104, 118, 135);\55}\56.ace-chrome .ace_comment {\57color: #236e24;\58}\59.ace-chrome .ace_comment.ace_doc {\60color: #236e24;\61}\62.ace-chrome .ace_comment.ace_doc.ace_tag {\63color: #236e24;\64}\65.ace-chrome .ace_constant.ace_numeric {\66color: rgb(0, 0, 205);\67}\68.ace-chrome .ace_variable {\69color: rgb(49, 132, 149);\70}\71.ace-chrome .ace_xml-pe {\72color: rgb(104, 104, 91);\73}\74.ace-chrome .ace_entity.ace_name.ace_function {\75color: #0000A2;\76}\77.ace-chrome .ace_heading {\78color: rgb(12, 7, 255);\79}\80.ace-chrome .ace_list {\81color:rgb(185, 6, 144);\82}\83.ace-chrome .ace_marker-layer .ace_selection {\84background: rgb(181, 213, 255);\85}\86.ace-chrome .ace_marker-layer .ace_step {\87background: rgb(252, 255, 0);\88}\89.ace-chrome .ace_marker-layer .ace_stack {\90background: rgb(164, 229, 101);\91}\92.ace-chrome .ace_marker-layer .ace_bracket {\93margin: -1px 0 0 -1px;\94border: 1px solid rgb(192, 192, 192);\95}\96.ace-chrome .ace_marker-layer .ace_active-line {\97background: rgba(0, 0, 0, 0.07);\98}\99.ace-chrome .ace_gutter-active-line {\100background-color : #dcdcdc;\101}\102.ace-chrome .ace_marker-layer .ace_selected-word {\103background: rgb(250, 250, 255);\104border: 1px solid rgb(200, 200, 250);\105}\106.ace-chrome .ace_storage,\107.ace-chrome .ace_keyword,\108.ace-chrome .ace_meta.ace_tag {\109color: rgb(147, 15, 128);\110}\111.ace-chrome .ace_string.ace_regex {\112color: rgb(255, 0, 0)\113}\114.ace-chrome .ace_string {\115color: #1A1AA6;\116}\117.ace-chrome .ace_entity.ace_other.ace_attribute-name {\118color: #994409;\119}\120.ace-chrome .ace_indent-guide {\121background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\122}\123";124var dom = require("../lib/dom");125dom.importCssString(exports.cssText, exports.cssClass, false);126}); (function() {127 window.require(["ace/theme/chrome"], function(m) {128 if (typeof module == "object" && typeof exports == "object" && module) {129 module.exports = m;130 }131 });132 })();...
chrome.py
Source:chrome.py
1# Copyright 2016 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4import collections5PackageInfo = collections.namedtuple(6 'PackageInfo',7 ['package', 'activity', 'cmdline_file', 'devtools_socket'])8PACKAGE_INFO = {9 'chrome_document': PackageInfo(10 'com.google.android.apps.chrome.document',11 'com.google.android.apps.chrome.document.ChromeLauncherActivity',12 'chrome-command-line',13 'chrome_devtools_remote'),14 'chrome': PackageInfo(15 'com.google.android.apps.chrome',16 'com.google.android.apps.chrome.Main',17 'chrome-command-line',18 'chrome_devtools_remote'),19 'chrome_beta': PackageInfo(20 'com.chrome.beta',21 'com.google.android.apps.chrome.Main',22 'chrome-command-line',23 'chrome_devtools_remote'),24 'chrome_stable': PackageInfo(25 'com.android.chrome',26 'com.google.android.apps.chrome.Main',27 'chrome-command-line',28 'chrome_devtools_remote'),29 'chrome_dev': PackageInfo(30 'com.chrome.dev',31 'com.google.android.apps.chrome.Main',32 'chrome-command-line',33 'chrome_devtools_remote'),34 'chrome_canary': PackageInfo(35 'com.chrome.canary',36 'com.google.android.apps.chrome.Main',37 'chrome-command-line',38 'chrome_devtools_remote'),39 'chrome_work': PackageInfo(40 'com.chrome.work',41 'com.google.android.apps.chrome.Main',42 'chrome-command-line',43 'chrome_devtools_remote'),44 'chromium': PackageInfo(45 'org.chromium.chrome',46 'com.google.android.apps.chrome.Main',47 'chrome-command-line',48 'chrome_devtools_remote'),49 'content_shell': PackageInfo(50 'org.chromium.content_shell_apk',51 '.ContentShellActivity',52 'content-shell-command-line',53 'content_shell_devtools_remote'),...
Using AI Code Generation
1const lambdium = require('lambdium');2const chrome = lambdium.chrome();3const lambdium = require('lambdium');4const firefox = lambdium.firefox();5const lambdium = require('lambdium');6const safari = lambdium.safari();7const lambdium = require('lambdium');8const ie = lambdium.ie();9const lambdium = require('lambdium');10const chrome = lambdium.chrome();11 .screenshot()12 .end()13 .then(function (buffer) {14 });15### lambdium.chrome(options)16Default: `{}`17Default: `{}`18Default: `{}`
Using AI Code Generation
1const chrome = require('lambdium-chrome');2exports.handler = async (event, context) => {3 const driver = await chrome.build();4 const title = await driver.getTitle();5 return { title };6};7### `build([options])`8#### `get(url)`9#### `getTitle()`10#### `findElement(locator)`11#### `findElements(locator)`12#### `getScreenshot()`13#### `executeScript(script[, ...args])`14#### `executeAsyncScript(script[, ...args])`15#### `close()`16#### `quit()`
Using AI Code Generation
1var lambdium = require('lambdium');2var chrome = lambdium.chrome;3var client = chrome();4client.getTitle().then(function (title) {5 console.log('Page title is: ' + title);6 client.quit();7});8var lambdium = require('lambdium');9var chromedriver = lambdium.chromedriver;10var client = chromedriver();11client.getTitle().then(function (title) {12 console.log('Page title is: ' + title);13 client.quit();14});15var lambdium = require('lambdium');16var phantomjs = lambdium.phantomjs;17var client = phantomjs();18client.getTitle().then(function (title) {19 console.log('Page title is: ' + title);20 client.quit();21});22var lambdium = require('lambdium');23var ie = lambdium.ie;24var client = ie();25client.getTitle().then(function (title) {26 console.log('Page title is: ' + title);27 client.quit();28});29#### get(url)30#### getTitle()31#### getCurrentUrl()32#### findElement(locator)33#### findElements(locator)34#### click(locator)35#### sendKeys(locator, keys)36#### clear(locator)37#### getAttribute(locator, attribute)38#### getText(locator)39#### isDisplayed(locator)
Using AI Code Generation
1var chrome = require('lambdium-chrome');2var fs = require('fs');3exports.handler = function(event, context) {4 chrome.run({5 chrome: {6 },7 fn: function() {8 return document.title;9 }10 }, function(err, response) {11 if (err) {12 console.log(err);13 context.fail(err);14 } else {15 console.log(response);16 context.succeed(response);17 }18 });19};
Using AI Code Generation
1const lambdium = require('lambdium');2const chrome = lambdium.chrome;3const fs = require('fs');4async function test() {5 let chromeInstance = await chrome();6 let html = await chromeInstance.html();7 fs.writeFileSync('test.html', html);8 await chromeInstance.close();9}10test();11- [lambdium](#lambdium)12- [lambdium.chrome](#lambdiumchrome)13- [lambdium.firefox](#lambdiumfirefox)14- [lambdium.edge](#lambdiumedge)15- [lambdium.safari](#lambdiumsafari)16- [lambdium.ie](#lambdiumie)17- [instance](#instance)18- [instance.goto](#instancegoto)19- [instance.html](#instancehtml)20- [instance.pdf](#instancepdf)21- [instance.screenshot](#instancescreenshot)22- [instance.close](#instanceclose)23const lambdium = require('lambdium');24lambdium({25 chrome: {26 },27 firefox: {28 }29});
Using AI Code Generation
1var lambdium = require('lambdium');2var chrome = lambdium.chrome;3var chromeInstance = chrome();4chromeInstance.goto(url, function(err, result) {5 if (err) {6 console.log(err);7 } else {8 console.log(result);9 }10});11### lambdium.chrome([options])12Default: `{}`13### lambdium.chrome.goto(url, [options], callback)14Default: `{}`
Using AI Code Generation
1lambdium.chrome('test', function (err, resp) {2 console.log(resp);3});4var chrome = function (name, cb) {5 return cb(null, 'Hello ' + name);6};7module.exports = chrome;8var chrome = require('./lambdium-chrome');9var chromeHandler = function (event, context) {10 chrome(event.name, function (err, resp) {11 if (err) {12 return context.done(err);13 }14 context.done(null, resp);15 });16};17exports.chrome = chromeHandler;18{19 "chrome": {20 }21}22lambdium.chrome('test', function (err, resp) {23 console.log(resp);24});25var chrome = function (name, cb) {26 return cb(null, 'Hello ' + name);27};28module.exports = chrome;29var chrome = require('./lambdium-chrome');30var chromeHandler = function (event, context) {31 chrome(event.name, function (err, resp) {32 if (err) {33 return context.done(err);34 }35 context.done(null, resp);36 });37};38exports.chrome = chromeHandler;39{40 "chrome": {41 }42}43lambdium.chrome('test', function (err, resp) {44 console.log(resp);45});46var chrome = function (name, cb) {47 return cb(null, 'Hello ' + name);48};49module.exports = chrome;50var chrome = require('./
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!