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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 private: | 27 private: |
28 DISALLOW_COPY_AND_ASSIGN(ReadCBHandler); | 28 DISALLOW_COPY_AND_ASSIGN(ReadCBHandler); |
29 }; | 29 }; |
30 | 30 |
31 // Returns a path to the test file which contains the string "0123456789" | 31 // Returns a path to the test file which contains the string "0123456789" |
32 // without the quotes or any trailing space or null termination. The file lives | 32 // without the quotes or any trailing space or null termination. The file lives |
33 // under the media/test/data directory. Under Windows, strings for the | 33 // under the media/test/data directory. Under Windows, strings for the |
34 // FilePath class are unicode, and the pipeline wants char strings. Convert | 34 // FilePath class are unicode, and the pipeline wants char strings. Convert |
35 // the string to UTF8 under Windows. For Mac and Linux, file paths are already | 35 // the string to UTF8 under Windows. For Mac and Linux, file paths are already |
36 // chars so just return the string from the FilePath. | 36 // chars so just return the string from the base::FilePath. |
37 FilePath TestFileURL() { | 37 FilePath TestFileURL() { |
38 FilePath data_dir; | 38 base::FilePath data_dir; |
39 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); | 39 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); |
40 data_dir = data_dir.Append(FILE_PATH_LITERAL("media")) | 40 data_dir = data_dir.Append(FILE_PATH_LITERAL("media")) |
41 .Append(FILE_PATH_LITERAL("test")) | 41 .Append(FILE_PATH_LITERAL("test")) |
42 .Append(FILE_PATH_LITERAL("data")) | 42 .Append(FILE_PATH_LITERAL("data")) |
43 .Append(FILE_PATH_LITERAL("ten_byte_file")); | 43 .Append(FILE_PATH_LITERAL("ten_byte_file")); |
44 return data_dir; | 44 return data_dir; |
45 } | 45 } |
46 | 46 |
47 // Test that FileDataSource call the appropriate methods on its filter host. | 47 // Test that FileDataSource call the appropriate methods on its filter host. |
48 TEST(FileDataSourceTest, OpenFile) { | 48 TEST(FileDataSourceTest, OpenFile) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |