Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: media/base/android/media_url_demuxer_unittest.cc

Issue 2090343004: Add GetUrl to DemuxerStreamProvider interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_url_demuxer_unittest.cc
diff --git a/media/base/android/media_url_demuxer_unittest.cc b/media/base/android/media_url_demuxer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..23347085fc8bbf9abcf54cc361b2ebf4c97d3a6e
--- /dev/null
+++ b/media/base/android/media_url_demuxer_unittest.cc
@@ -0,0 +1,73 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+#include "media/base/android/media_url_demuxer.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+class MediaUrlDemuxerTest : public testing::Test {
+ public:
+ MediaUrlDemuxerTest() {}
+
+ void Initialize(const GURL& gurl) {
+ demuxer_.reset(new MediaUrlDemuxer(gurl));
+ }
+
+ void Initialize() { Initialize(GURL(kDefaultUrl)); }
+
+ const std::string kDefaultUrl = "http://example.com/";
+
+ std::unique_ptr<Demuxer> demuxer_;
+
+ private:
+ // A message loop needs to be instantiated in order for the test to run
+ // properly.
+ base::MessageLoop message_loop_;
xhwang 2016/06/24 03:19:47 Use RunLoop now. Actually, why do you need a mess
tguilbert 2016/06/24 21:18:42 I don't, removed! (artifact of copy-pasting)
+
+ DISALLOW_COPY_AND_ASSIGN(MediaUrlDemuxerTest);
+};
+
+TEST_F(MediaUrlDemuxerTest, DoesNotReturnStreams) {
xhwang 2016/06/24 03:19:47 Check the type.
tguilbert 2016/06/24 21:18:42 Done.
+ Initialize();
+
+ DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::Type::AUDIO);
+ DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::Type::VIDEO);
+ DemuxerStream* text_stream = demuxer_->GetStream(DemuxerStream::Type::TEXT);
xhwang 2016/06/24 03:19:47 We can specify in the API that if the type is URL,
tguilbert 2016/06/24 21:18:42 Done.
+
+ // Should not return AUDIO/VIDEO/TEXT streams
+ ASSERT_EQ(nullptr, audio_stream);
+ ASSERT_EQ(nullptr, video_stream);
+ ASSERT_EQ(nullptr, text_stream);
+}
+
+TEST_F(MediaUrlDemuxerTest, AcceptsNormalUrl) {
+ Initialize();
+
+ GURL url = demuxer_->GetUrl();
+
+ ASSERT_EQ(kDefaultUrl, url.spec());
+}
+
+TEST_F(MediaUrlDemuxerTest, AcceptsEmptyStrings) {
+ Initialize(GURL());
+
+ GURL url = demuxer_->GetUrl();
+
+ ASSERT_EQ(GURL::EmptyGURL(), url);
+}
+
+TEST_F(MediaUrlDemuxerTest, VerifyIdempotenceOfGetUrl) {
+ Initialize();
+
+ GURL url = demuxer_->GetUrl();
+ GURL url_clone = demuxer_->GetUrl();
+
+ ASSERT_EQ(url, url_clone);
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698