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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); | 38 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); |
39 data_dir = data_dir.Append(FILE_PATH_LITERAL("media")) | 39 data_dir = data_dir.Append(FILE_PATH_LITERAL("media")) |
40 .Append(FILE_PATH_LITERAL("test")) | 40 .Append(FILE_PATH_LITERAL("test")) |
41 .Append(FILE_PATH_LITERAL("data")) | 41 .Append(FILE_PATH_LITERAL("data")) |
42 .Append(FILE_PATH_LITERAL("ten_byte_file")); | 42 .Append(FILE_PATH_LITERAL("ten_byte_file")); |
43 return data_dir; | 43 return data_dir; |
44 } | 44 } |
45 | 45 |
46 // Use the mock filter host to directly call the Read and GetPosition methods. | 46 // Use the mock filter host to directly call the Read and GetPosition methods. |
47 TEST(FileDataSourceTest, ReadData) { | 47 TEST(FileDataSourceTest, ReadData) { |
48 int64 size; | 48 int64_t size; |
49 uint8 ten_bytes[10]; | 49 uint8_t ten_bytes[10]; |
50 | 50 |
51 // Create our mock filter host and initialize the data source. | 51 // Create our mock filter host and initialize the data source. |
52 FileDataSource data_source; | 52 FileDataSource data_source; |
53 | 53 |
54 EXPECT_TRUE(data_source.Initialize(TestFileURL())); | 54 EXPECT_TRUE(data_source.Initialize(TestFileURL())); |
55 EXPECT_TRUE(data_source.GetSize(&size)); | 55 EXPECT_TRUE(data_source.GetSize(&size)); |
56 EXPECT_EQ(10, size); | 56 EXPECT_EQ(10, size); |
57 | 57 |
58 ReadCBHandler handler; | 58 ReadCBHandler handler; |
59 EXPECT_CALL(handler, ReadCB(10)); | 59 EXPECT_CALL(handler, ReadCB(10)); |
(...skipping 14 matching lines...) Expand all Loading... |
74 | 74 |
75 EXPECT_CALL(handler, ReadCB(5)); | 75 EXPECT_CALL(handler, ReadCB(5)); |
76 data_source.Read(5, 10, ten_bytes, base::Bind( | 76 data_source.Read(5, 10, ten_bytes, base::Bind( |
77 &ReadCBHandler::ReadCB, base::Unretained(&handler))); | 77 &ReadCBHandler::ReadCB, base::Unretained(&handler))); |
78 EXPECT_EQ('5', ten_bytes[0]); | 78 EXPECT_EQ('5', ten_bytes[0]); |
79 | 79 |
80 data_source.Stop(); | 80 data_source.Stop(); |
81 } | 81 } |
82 | 82 |
83 } // namespace media | 83 } // namespace media |
OLD | NEW |