OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
6 #define CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "content/public/test/content_browser_test.h" | 11 #include "content/public/test/content_browser_test.h" |
| 12 #include "media/base/test_data_util.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class TitleWatcher; | 16 class TitleWatcher; |
16 | 17 |
17 // Class used to automate running media related browser tests. The functions | 18 // Class used to automate running media related browser tests. The functions |
18 // assume that media files are located under files/media/ folder known to | 19 // assume that media files are located under files/media/ folder known to |
19 // the test http server. | 20 // the test http server. |
20 class MediaBrowserTest : public ContentBrowserTest { | 21 class MediaBrowserTest : public ContentBrowserTest { |
21 public: | 22 public: |
22 typedef std::pair<const char*, const char*> StringPair; | |
23 | |
24 // Common test results. | 23 // Common test results. |
25 static const char kEnded[]; | 24 static const char kEnded[]; |
26 static const char kError[]; | 25 static const char kError[]; |
27 static const char kFailed[]; | 26 static const char kFailed[]; |
28 | 27 |
29 // Runs a html page with a list of URL query parameters. | 28 // Runs a html page with a list of URL query parameters. |
30 // If http is true, the test starts a local http test server to load the test | 29 // If http is true, the test starts a local http test server to load the test |
31 // page, otherwise a local file URL is loaded inside the content shell. | 30 // page, otherwise a local file URL is loaded inside the content shell. |
32 // It uses RunTest() to check for expected test output. | 31 // It uses RunTest() to check for expected test output. |
33 void RunMediaTestPage(const char* html_page, | 32 void RunMediaTestPage(const std::string& html_page, |
34 std::vector<StringPair>* query_params, | 33 std::vector<media::StringPair>* query_params, |
35 const char* expected, bool http); | 34 const std::string& expected, |
| 35 bool http); |
36 | 36 |
37 // Opens a URL and waits for the document title to match either one of the | 37 // Opens a URL and waits for the document title to match either one of the |
38 // default strings or the expected string. | 38 // default strings or the expected string. |
39 void RunTest(const GURL& gurl, const char* expected); | 39 std::string RunTest(const GURL& gurl, const std::string& expected); |
40 | 40 |
41 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); | 41 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace content | 44 } // namespace content |
45 | 45 |
46 #endif // CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 46 #endif // CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
OLD | NEW |