OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/browser/media/media_browsertest.h" | 5 #include "content/browser/media/media_browsertest.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 gurl = test_server()->GetURL( | 52 gurl = test_server()->GetURL( |
53 base::StringPrintf("files/media/%s?%s", html_page, query.c_str())); | 53 base::StringPrintf("files/media/%s?%s", html_page, query.c_str())); |
54 } else { | 54 } else { |
55 base::FilePath test_file_path = GetTestFilePath("media", html_page); | 55 base::FilePath test_file_path = GetTestFilePath("media", html_page); |
56 gurl = GetFileUrlWithQuery(test_file_path, query); | 56 gurl = GetFileUrlWithQuery(test_file_path, query); |
57 } | 57 } |
58 RunTest(gurl, expected); | 58 RunTest(gurl, expected); |
59 } | 59 } |
60 | 60 |
61 void MediaBrowserTest::RunTest(const GURL& gurl, const char* expected) { | 61 void MediaBrowserTest::RunTest(const GURL& gurl, const char* expected) { |
62 const base::string16 expected_title = ASCIIToUTF16(expected); | 62 const base::string16 expected_title = base::ASCIIToUTF16(expected); |
63 DVLOG(1) << "Running test URL: " << gurl; | 63 DVLOG(1) << "Running test URL: " << gurl; |
64 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 64 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
65 AddWaitForTitles(&title_watcher); | 65 AddWaitForTitles(&title_watcher); |
66 NavigateToURL(shell(), gurl); | 66 NavigateToURL(shell(), gurl); |
67 | 67 |
68 base::string16 final_title = title_watcher.WaitAndGetTitle(); | 68 base::string16 final_title = title_watcher.WaitAndGetTitle(); |
69 EXPECT_EQ(expected_title, final_title); | 69 EXPECT_EQ(expected_title, final_title); |
70 } | 70 } |
71 | 71 |
72 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { | 72 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { |
73 title_watcher->AlsoWaitForTitle(ASCIIToUTF16(kEnded)); | 73 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); |
74 title_watcher->AlsoWaitForTitle(ASCIIToUTF16(kError)); | 74 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); |
75 title_watcher->AlsoWaitForTitle(ASCIIToUTF16(kFailed)); | 75 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); |
76 } | 76 } |
77 | 77 |
78 // Tests playback and seeking of an audio or video file over file or http based | 78 // Tests playback and seeking of an audio or video file over file or http based |
79 // on a test parameter. Test starts with playback, then, after X seconds or the | 79 // on a test parameter. Test starts with playback, then, after X seconds or the |
80 // ended event fires, seeks near end of file; see player.html for details. The | 80 // ended event fires, seeks near end of file; see player.html for details. The |
81 // test completes when either the last 'ended' or an 'error' event fires. | 81 // test completes when either the last 'ended' or an 'error' event fires. |
82 class MediaTest : public testing::WithParamInterface<bool>, | 82 class MediaTest : public testing::WithParamInterface<bool>, |
83 public MediaBrowserTest { | 83 public MediaBrowserTest { |
84 public: | 84 public: |
85 // Play specified audio over http:// or file:// depending on |http| setting. | 85 // Play specified audio over http:// or file:// depending on |http| setting. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 #if defined(OS_CHROMEOS) | 255 #if defined(OS_CHROMEOS) |
256 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { | 256 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { |
257 RunColorFormatTest("yuv420p.avi", "ENDED"); | 257 RunColorFormatTest("yuv420p.avi", "ENDED"); |
258 } | 258 } |
259 #endif // defined(OS_CHROMEOS) | 259 #endif // defined(OS_CHROMEOS) |
260 #endif // defined(USE_PROPRIETARY_CODECS) | 260 #endif // defined(USE_PROPRIETARY_CODECS) |
261 | 261 |
262 } // namespace content | 262 } // namespace content |
OLD | NEW |