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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "net/test/spawned_test_server/spawned_test_server.h" | |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
17 class DecoderBuffer; | 18 class DecoderBuffer; |
18 | 19 |
20 typedef std::pair<std::string, std::string> StringPair; | |
xhwang
2014/07/07 17:39:55
It seems we alway use StringPair in std::vector<me
shadi
2014/07/07 22:58:44
Since we only use the vector to iterate once over
| |
21 | |
19 // Returns a file path for a file in the media/test/data directory. | 22 // Returns a file path for a file in the media/test/data directory. |
20 base::FilePath GetTestDataFilePath(const std::string& name); | 23 base::FilePath GetTestDataFilePath(const std::string& name); |
21 | 24 |
25 // Returns relative path for test data folder: media/test/data. | |
26 base::FilePath GetTestDataPath(); | |
27 | |
28 // Starts an HTTP server serving files from media data path. | |
29 scoped_ptr<net::SpawnedTestServer> StartMediaHttpTestServer(); | |
xhwang
2014/07/07 17:39:55
Newbie question: what happens when the returned sc
shadi
2014/07/07 22:58:44
Yes, the destructor calls Stop() on the server. Ha
| |
30 | |
31 // Returns a string containing key value query params in the form of: | |
32 // "key_1=value_1&key_2=value2" | |
33 std::string GetURLQueryString(std::vector<StringPair>* query_params); | |
xhwang
2014/07/07 17:39:55
It seems |query_params| is an input param and shou
shadi
2014/07/07 22:58:44
Done.
| |
34 | |
22 // Reads a test file from media/test/data directory and stores it in | 35 // Reads a test file from media/test/data directory and stores it in |
23 // a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter | 36 // a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter |
24 // what a test does, it's safe to use FFmpeg methods. | 37 // what a test does, it's safe to use FFmpeg methods. |
25 // | 38 // |
26 // |name| - The name of the file. | 39 // |name| - The name of the file. |
27 // |buffer| - The contents of the file. | 40 // |buffer| - The contents of the file. |
28 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name); | 41 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name); |
29 | 42 |
30 } // namespace media | 43 } // namespace media |
31 | 44 |
32 #endif // MEDIA_BASE_TEST_DATA_UTIL_H_ | 45 #endif // MEDIA_BASE_TEST_DATA_UTIL_H_ |
OLD | NEW |