OLD | NEW |
1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return WideToUTF8(data_dir.value()); | 46 return WideToUTF8(data_dir.value()); |
47 #else | 47 #else |
48 return data_dir.value(); | 48 return data_dir.value(); |
49 #endif | 49 #endif |
50 } | 50 } |
51 | 51 |
52 // Test that FileDataSource call the appropriate methods on its filter host. | 52 // Test that FileDataSource call the appropriate methods on its filter host. |
53 TEST(FileDataSourceTest, OpenFile) { | 53 TEST(FileDataSourceTest, OpenFile) { |
54 StrictMock<MockDataSourceHost> host; | 54 StrictMock<MockDataSourceHost> host; |
55 EXPECT_CALL(host, SetTotalBytes(10)); | 55 EXPECT_CALL(host, SetTotalBytes(10)); |
56 EXPECT_CALL(host, SetBufferedBytes(10)); | 56 EXPECT_CALL(host, AddBufferedByteRange(0, 10)); |
57 | 57 |
58 scoped_refptr<FileDataSource> filter(new FileDataSource()); | 58 scoped_refptr<FileDataSource> filter(new FileDataSource()); |
59 filter->set_host(&host); | 59 filter->set_host(&host); |
60 EXPECT_EQ(PIPELINE_OK, filter->Initialize(TestFileURL())); | 60 EXPECT_EQ(PIPELINE_OK, filter->Initialize(TestFileURL())); |
61 | 61 |
62 filter->Stop(NewExpectedClosure()); | 62 filter->Stop(NewExpectedClosure()); |
63 } | 63 } |
64 | 64 |
65 // Use the mock filter host to directly call the Read and GetPosition methods. | 65 // Use the mock filter host to directly call the Read and GetPosition methods. |
66 TEST(FileDataSourceTest, ReadData) { | 66 TEST(FileDataSourceTest, ReadData) { |
(...skipping 24 matching lines...) Expand all Loading... |
91 | 91 |
92 EXPECT_CALL(handler, ReadCB(5)); | 92 EXPECT_CALL(handler, ReadCB(5)); |
93 filter->Read(5, 10, ten_bytes, base::Bind( | 93 filter->Read(5, 10, ten_bytes, base::Bind( |
94 &ReadCBHandler::ReadCB, base::Unretained(&handler))); | 94 &ReadCBHandler::ReadCB, base::Unretained(&handler))); |
95 EXPECT_EQ('5', ten_bytes[0]); | 95 EXPECT_EQ('5', ten_bytes[0]); |
96 | 96 |
97 filter->Stop(NewExpectedClosure()); | 97 filter->Stop(NewExpectedClosure()); |
98 } | 98 } |
99 | 99 |
100 } // namespace media | 100 } // namespace media |
OLD | NEW |