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

Unified Diff: media/filters/file_data_source_unittest.cc

Issue 155469: Splitting media filter's Initialize() into Create() + callback and Seek() + callback. (Closed)
Patch Set: Fixed valgrind errors Created 11 years, 5 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
« no previous file with comments | « media/filters/file_data_source.cc ('k') | media/filters/video_renderer_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/file_data_source_unittest.cc
diff --git a/media/filters/file_data_source_unittest.cc b/media/filters/file_data_source_unittest.cc
index dd41e88e3ca7cded28a5fa28a5e20a96e2061e45..9c4b9ee8cbce8fe3cc44eb1c9db987ca42f630ed 100644
--- a/media/filters/file_data_source_unittest.cc
+++ b/media/filters/file_data_source_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_path.h"
#include "base/string_util.h"
#include "media/base/mock_filter_host.h"
+#include "media/base/mock_filters.h"
#include "media/filters/file_data_source.h"
using ::testing::NiceMock;
@@ -38,13 +39,15 @@ std::string TestFileURL() {
// Test that FileDataSource call the appropriate methods on its filter host.
TEST(FileDataSourceTest, OpenFile) {
StrictMock<MockFilterHost> host;
+ StrictMock<MockFilterCallback> callback;
EXPECT_CALL(host, SetTotalBytes(10));
EXPECT_CALL(host, SetBufferedBytes(10));
- EXPECT_CALL(host, InitializationComplete());
+ EXPECT_CALL(callback, OnFilterCallback());
+ EXPECT_CALL(callback, OnCallbackDestroyed());
scoped_refptr<FileDataSource> filter = new FileDataSource();
filter->set_host(&host);
- EXPECT_TRUE(filter->Initialize(TestFileURL()));
+ filter->Initialize(TestFileURL(), callback.NewCallback());
}
// Use the mock filter host to directly call the Read and GetPosition methods.
@@ -55,9 +58,10 @@ TEST(FileDataSourceTest, ReadData) {
// Create our mock filter host and initialize the data source.
NiceMock<MockFilterHost> host;
+ NiceMock<MockFilterCallback> callback;
scoped_refptr<FileDataSource> filter = new FileDataSource();
filter->set_host(&host);
- EXPECT_TRUE(filter->Initialize(TestFileURL()));
+ filter->Initialize(TestFileURL(), callback.NewCallback());
EXPECT_TRUE(filter->GetSize(&size));
EXPECT_EQ(10, size);
@@ -80,4 +84,15 @@ TEST(FileDataSourceTest, ReadData) {
EXPECT_EQ(10, position);
}
+// Test that FileDataSource does nothing on Seek().
+TEST(FileDataSourceTest, Seek) {
+ StrictMock<MockFilterCallback> callback;
+ EXPECT_CALL(callback, OnFilterCallback());
+ EXPECT_CALL(callback, OnCallbackDestroyed());
+ const base::TimeDelta kZero;
+
+ scoped_refptr<FileDataSource> filter = new FileDataSource();
+ filter->Seek(kZero, callback.NewCallback());
+}
+
} // namespace media
« no previous file with comments | « media/filters/file_data_source.cc ('k') | media/filters/video_renderer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698