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