1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_FakeTVService_h
8 #define mozilla_dom_FakeTVService_h
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsITVService.h"
15 #define FAKE_TV_SERVICE_CONTRACTID \
16 "@mozilla.org/tv/faketvservice;1"
17 #define FAKE_TV_SERVICE_CID \
18 { 0x60fb3c53, 0x017f, 0x4340, { 0x91, 0x1b, 0xd5, 0x5c, 0x31, 0x28, 0x88, 0xb6 } }
22 class nsITVChannelData
;
23 class nsITVProgramData
;
28 class FakeTVService MOZ_FINAL
: public nsITVService
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_CLASS(FakeTVService
)
44 bool IsAllowed(const nsAString
& aTunerId
,
45 const nsAString
& aSourceType
);
47 already_AddRefed
<nsITVTunerData
> MockTuner(const nsAString
& aId
,
48 uint32_t aSupportedSourceTypeCount
,
49 const char** aSupportedSourceTypes
);
51 already_AddRefed
<nsITVChannelData
> MockChannel(const nsAString
& aNetworkId
,
52 const nsAString
& aTransportStreamId
,
53 const nsAString
& aServiceId
,
54 const nsAString
& aType
,
55 const nsAString
& aNumber
,
56 const nsAString
& aName
,
60 already_AddRefed
<nsITVProgramData
> MockProgram(const nsAString
& aEventId
,
61 const nsAString
& aTitle
,
64 const nsAString
& aDescription
,
65 const nsAString
& aRating
,
66 uint32_t aAudioLanguageCount
,
67 const char** aAudioLanguages
,
68 uint32_t aSubtitleLanguageCount
,
69 const char** aSubtitleLanguages
);
71 nsCOMPtr
<nsITVSourceListener
> mSourceListener
;
73 // The real implementation may want to use more efficient data structures.
74 nsTArray
<nsCOMPtr
<nsITVTunerData
>> mTuners
;
75 nsTArray
<nsCOMPtr
<nsITVChannelData
>> mChannels
;
76 nsTArray
<nsCOMPtr
<nsITVProgramData
>> mPrograms
;
77 nsCOMPtr
<nsITimer
> mEITBroadcastedTimer
;
78 nsCOMPtr
<nsITimer
> mScanCompleteTimer
;
82 } // namespace mozilla
84 #endif // mozilla_dom_FakeTVService_h