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 CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
6 #define CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class TitleWatcher; | 14 class TitleWatcher; |
15 } | 15 } |
16 | 16 |
17 // Class used to automate running media related browser tests. The functions | 17 // Class used to automate running media related browser tests. The functions |
18 // assume that media files are located under files/media/ folder known to | 18 // assume that media files are located under files/media/ folder known to |
19 // the test http server. | 19 // the test http server. |
20 class MediaBrowserTest : public InProcessBrowserTest { | 20 class MediaBrowserTest : public InProcessBrowserTest { |
21 protected: | 21 protected: |
22 typedef std::pair<const char*, const char*> StringPair; | 22 typedef std::pair<const char*, const char*> StringPair; |
23 | 23 |
24 // Common test results. | 24 // Common test results. |
25 static const char kEnded[]; | 25 static const char kEnded[]; |
26 // TODO(xhwang): Report detailed errors, e.g. "ERROR-3". | |
ddorwin
2014/01/09 02:04:31
s/errors/MediaErrors/
Otherwise, it's not clear th
| |
26 static const char kError[]; | 27 static const char kError[]; |
27 static const char kFailed[]; | 28 static const char kFailed[]; |
28 | 29 |
29 MediaBrowserTest(); | 30 MediaBrowserTest(); |
30 virtual ~MediaBrowserTest(); | 31 virtual ~MediaBrowserTest(); |
31 | 32 |
32 // Runs a html page with a list of URL query parameters. | 33 // Runs a html page with a list of URL query parameters. |
33 // If http is true, the test starts a local http test server to load the test | 34 // If http is true, the test starts a local http test server to load the test |
34 // page, otherwise a local file URL is loaded inside the content shell. | 35 // page, otherwise a local file URL is loaded inside the content shell. |
35 // It uses RunTest() to check for expected test output. | 36 // It uses RunTest() to check for expected test output. |
36 void RunMediaTestPage(const char* html_page, | 37 void RunMediaTestPage(const char* html_page, |
37 std::vector<StringPair>* query_params, | 38 std::vector<StringPair>* query_params, |
38 const char* expected, bool http); | 39 const char* expected, bool http); |
39 | 40 |
40 // Opens a URL and waits for the document title to match either one of the | 41 // Opens a URL and waits for the document title to match either one of the |
41 // default strings or the expected string. | 42 // default strings or the expected string. |
42 base::string16 RunTest(const GURL& gurl, const char* expected); | 43 base::string16 RunTest(const GURL& gurl, const char* expected); |
43 | 44 |
44 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); | 45 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); |
45 }; | 46 }; |
46 | 47 |
47 #endif // CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 48 #endif // CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
OLD | NEW |