Bumping manifests a=b2g-bump
[gecko.git] / dom / tv / FakeTVService.h
blob337b85e39ed4e524c68fb05419484bd036689f33
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
10 #include "nsCOMPtr.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsITVService.h"
13 #include "nsTArray.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 } }
20 class nsITimer;
21 class nsITVTunerData;
22 class nsITVChannelData;
23 class nsITVProgramData;
25 namespace mozilla {
26 namespace dom {
28 class FakeTVService MOZ_FINAL : public nsITVService
30 public:
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_CLASS(FakeTVService)
33 NS_DECL_NSITVSERVICE
35 FakeTVService();
37 private:
38 ~FakeTVService();
40 void Init();
42 void Shutdown();
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,
57 bool aIsEmergency,
58 bool aIsFree);
60 already_AddRefed<nsITVProgramData> MockProgram(const nsAString& aEventId,
61 const nsAString& aTitle,
62 uint64_t aStartTime,
63 uint64_t aDuration,
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;
81 } // namespace dom
82 } // namespace mozilla
84 #endif // mozilla_dom_FakeTVService_h