OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "media/base/mock_filters.h" | 7 #include "media/base/mock_filters.h" |
8 #include "media/ffmpeg/ffmpeg_common.h" | 8 #include "media/ffmpeg/ffmpeg_common.h" |
9 #include "media/filters/ffmpeg_glue.h" | 9 #include "media/filters/ffmpeg_glue.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Prepare FFmpeg URLContext structure. | 148 // Prepare FFmpeg URLContext structure. |
149 URLContext context; | 149 URLContext context; |
150 memset(&context, 0, sizeof(context)); | 150 memset(&context, 0, sizeof(context)); |
151 | 151 |
152 // Test opening a URLContext with a protocol that doesn't exist. | 152 // Test opening a URLContext with a protocol that doesn't exist. |
153 EXPECT_EQ(AVERROR(EIO), protocol_->url_open(&context, "foobar", 0)); | 153 EXPECT_EQ(AVERROR(EIO), protocol_->url_open(&context, "foobar", 0)); |
154 | 154 |
155 // Test opening a URLContext with our protocol. | 155 // Test opening a URLContext with our protocol. |
156 EXPECT_EQ(0, protocol_->url_open(&context, key.c_str(), 0)); | 156 EXPECT_EQ(0, protocol_->url_open(&context, key.c_str(), 0)); |
157 EXPECT_EQ(URL_RDONLY, context.flags); | 157 EXPECT_EQ(AVIO_FLAG_READ, context.flags); |
158 EXPECT_EQ(protocol.get(), context.priv_data); | 158 EXPECT_EQ(protocol.get(), context.priv_data); |
159 EXPECT_TRUE(context.is_streamed); | 159 EXPECT_TRUE(context.is_streamed); |
160 | 160 |
161 // We're going to remove references one by one until the last reference is | 161 // We're going to remove references one by one until the last reference is |
162 // held by FFmpeg. Once we close the URLContext, the protocol should be | 162 // held by FFmpeg. Once we close the URLContext, the protocol should be |
163 // destroyed. | 163 // destroyed. |
164 InSequence s; | 164 InSequence s; |
165 EXPECT_CALL(*this, CheckPoint(0)); | 165 EXPECT_CALL(*this, CheckPoint(0)); |
166 EXPECT_CALL(*this, CheckPoint(1)); | 166 EXPECT_CALL(*this, CheckPoint(1)); |
167 EXPECT_CALL(*protocol, OnDestroy()); | 167 EXPECT_CALL(*protocol, OnDestroy()); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 // Remove our own reference, we shouldn't be destroyed yet. | 315 // Remove our own reference, we shouldn't be destroyed yet. |
316 CheckPoint(0); | 316 CheckPoint(0); |
317 protocol.reset(); | 317 protocol.reset(); |
318 | 318 |
319 // ~FFmpegGlue() will be called when this unit test finishes execution. By | 319 // ~FFmpegGlue() will be called when this unit test finishes execution. By |
320 // leaving something inside FFmpegGlue's map we get to test our cleanup code. | 320 // leaving something inside FFmpegGlue's map we get to test our cleanup code. |
321 } | 321 } |
322 | 322 |
323 } // namespace media | 323 } // namespace media |
OLD | NEW |