| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
| 11 #include "media/base/test_data_util.h" | 11 #include "media/base/test_data_util.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class TitleWatcher; | 15 class TitleWatcher; |
| 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 media/ folder known to the test | 18 // assume that media files are located under media/ folder known to the test |
| 19 // http server. | 19 // http server. |
| 20 class MediaBrowserTest : public ContentBrowserTest { | 20 class MediaBrowserTest : public ContentBrowserTest { |
| 21 public: | 21 public: |
| 22 // Common test results. | 22 // Common test results. |
| 23 static const char kEnded[]; | 23 static const char kEnded[]; |
| 24 static const char kError[]; | 24 static const char kError[]; |
| 25 static const char kFailed[]; | 25 static const char kFailed[]; |
| 26 | 26 |
| 27 // ContentBrowserTest implementation. |
| 28 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 29 |
| 27 // Runs a html page with a list of URL query parameters. | 30 // Runs a html page with a list of URL query parameters. |
| 28 // If http is true, the test starts a local http test server to load the test | 31 // If http is true, the test starts a local http test server to load the test |
| 29 // page, otherwise a local file URL is loaded inside the content shell. | 32 // page, otherwise a local file URL is loaded inside the content shell. |
| 30 // It uses RunTest() to check for expected test output. | 33 // It uses RunTest() to check for expected test output. |
| 31 void RunMediaTestPage(const std::string& html_page, | 34 void RunMediaTestPage(const std::string& html_page, |
| 32 const base::StringPairs& query_params, | 35 const base::StringPairs& query_params, |
| 33 const std::string& expected, | 36 const std::string& expected, |
| 34 bool http); | 37 bool http); |
| 35 | 38 |
| 36 // Opens a URL and waits for the document title to match either one of the | 39 // Opens a URL and waits for the document title to match either one of the |
| 37 // default strings or the expected string. Returns the matching title value. | 40 // default strings or the expected string. Returns the matching title value. |
| 38 std::string RunTest(const GURL& gurl, const std::string& expected); | 41 std::string RunTest(const GURL& gurl, const std::string& expected); |
| 39 | 42 |
| 40 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); | 43 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 } // namespace content | 46 } // namespace content |
| 44 | 47 |
| 45 #endif // CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ | 48 #endif // CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ |
| OLD | NEW |