Bug 1254858: P4. Allow to pass mimetype in constructor. r=kentuckyfriedtakahe a=ritu
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 09 Mar 2016 21:21:57 +1100
changeset 323720 78260f138a89defebc4902aec2dab773f5ffc9bf
parent 323719 f7020c4cc1c469d4ad6099ff5564df3baf973bb6
child 323721 15393c275f93da2f176d60e4bd3d2dc4b9f38254
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe, ritu
bugs1254858
milestone47.0a2
Bug 1254858: P4. Allow to pass mimetype in constructor. r=kentuckyfriedtakahe a=ritu MozReview-Commit-ID: 1viNCf5quO5
dom/media/gtest/MockMediaResource.cpp
dom/media/gtest/MockMediaResource.h
--- a/dom/media/gtest/MockMediaResource.cpp
+++ b/dom/media/gtest/MockMediaResource.cpp
@@ -5,20 +5,20 @@
 #include "MockMediaResource.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
 namespace mozilla
 {
 
-MockMediaResource::MockMediaResource(const char* aFileName)
+MockMediaResource::MockMediaResource(const char* aFileName, const nsACString& aContentType)
   : mFileHandle(nullptr)
   , mFileName(aFileName)
-  , mContentType(NS_LITERAL_CSTRING("video/mp4"))
+  , mContentType(aContentType)
 {
 }
 
 nsresult
 MockMediaResource::Open(nsIStreamListener** aStreamListener)
 {
   mFileHandle = fopen(mFileName, "rb");
   if (mFileHandle == nullptr) {
--- a/dom/media/gtest/MockMediaResource.h
+++ b/dom/media/gtest/MockMediaResource.h
@@ -10,17 +10,17 @@
 #include "mozilla/Atomics.h"
 
 namespace mozilla
 {
 
 class MockMediaResource : public MediaResource
 {
 public:
-  explicit MockMediaResource(const char* aFileName);
+  explicit MockMediaResource(const char* aFileName, const nsACString& aMimeType = NS_LITERAL_CSTRING("video/mp4"));
   nsIURI* URI() const override { return nullptr; }
   nsresult Close() override { return NS_OK; }
   void Suspend(bool aCloseImmediately) override {}
   void Resume() override {}
   already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override
   {
     return nullptr;
   }
@@ -70,14 +70,14 @@ public:
 protected:
   virtual ~MockMediaResource();
 
 private:
   FILE* mFileHandle;
   const char* mFileName;
   MediaByteRangeSet mRanges;
   Atomic<int> mEntry;
-  nsCString mContentType;
+  const nsCString mContentType;
 };
 
 } // namespace mozilla
 
 #endif