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 #ifndef MEDIA_BASE_TEST_DATA_UTIL_H_ | 5 #ifndef MEDIA_BASE_TEST_DATA_UTIL_H_ |
6 #define MEDIA_BASE_TEST_DATA_UTIL_H_ | 6 #define MEDIA_BASE_TEST_DATA_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | |
10 #include <vector> | |
11 | 9 |
12 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
13 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
14 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
16 #include "net/test/spawned_test_server/spawned_test_server.h" | |
17 | 14 |
18 namespace media { | 15 namespace media { |
19 | 16 |
20 class DecoderBuffer; | 17 class DecoderBuffer; |
21 | 18 |
22 typedef std::vector<std::pair<std::string, std::string> > QueryParams; | |
23 | |
24 // Returns a file path for a file in the media/test/data directory. | 19 // Returns a file path for a file in the media/test/data directory. |
25 base::FilePath GetTestDataFilePath(const std::string& name); | 20 base::FilePath GetTestDataFilePath(const std::string& name); |
26 | 21 |
27 // Returns relative path for test data folder: media/test/data. | |
28 base::FilePath GetTestDataPath(); | |
29 | |
30 // Starts an HTTP server serving files from media data path. | |
31 scoped_ptr<net::SpawnedTestServer> StartMediaHttpTestServer(); | |
32 | |
33 // Returns a string containing key value query params in the form of: | |
34 // "key_1=value_1&key_2=value2" | |
35 std::string GetURLQueryString(const QueryParams& query_params); | |
36 | |
37 // Reads a test file from media/test/data directory and stores it in | 22 // Reads a test file from media/test/data directory and stores it in |
38 // a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter | 23 // a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter |
39 // what a test does, it's safe to use FFmpeg methods. | 24 // what a test does, it's safe to use FFmpeg methods. |
40 // | 25 // |
41 // |name| - The name of the file. | 26 // |name| - The name of the file. |
42 // |buffer| - The contents of the file. | 27 // |buffer| - The contents of the file. |
43 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name); | 28 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name); |
44 | 29 |
45 } // namespace media | 30 } // namespace media |
46 | 31 |
47 #endif // MEDIA_BASE_TEST_DATA_UTIL_H_ | 32 #endif // MEDIA_BASE_TEST_DATA_UTIL_H_ |
OLD | NEW |