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/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/content_browser_test_utils.h" | 10 #include "content/public/test/content_browser_test_utils.h" |
11 #include "content/shell/browser/shell.h" | 11 #include "content/shell/browser/shell.h" |
| 12 #include "media/base/test_data_util.h" |
| 13 #include "net/test/spawned_test_server/spawned_test_server.h" |
12 | 14 |
13 // TODO(wolenetz): Fix Media.YUV* tests on MSVS 2012 x64. crbug.com/180074 | 15 // TODO(wolenetz): Fix Media.YUV* tests on MSVS 2012 x64. crbug.com/180074 |
14 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) && _MSC_VER == 1700 | 16 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) && _MSC_VER == 1700 |
15 #define MAYBE(x) DISABLED_##x | 17 #define MAYBE(x) DISABLED_##x |
16 #else | 18 #else |
17 #define MAYBE(x) x | 19 #define MAYBE(x) x |
18 #endif | 20 #endif |
19 | 21 |
20 namespace content { | 22 namespace content { |
21 | 23 |
22 // Common test results. | 24 // Common test results. |
23 const char MediaBrowserTest::kEnded[] = "ENDED"; | 25 const char MediaBrowserTest::kEnded[] = "ENDED"; |
24 const char MediaBrowserTest::kError[] = "ERROR"; | 26 const char MediaBrowserTest::kError[] = "ERROR"; |
25 const char MediaBrowserTest::kFailed[] = "FAILED"; | 27 const char MediaBrowserTest::kFailed[] = "FAILED"; |
26 | 28 |
27 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, | 29 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, |
28 const media::QueryParams& query_params, | 30 const media::QueryParams& query_params, |
29 const std::string& expected_title, | 31 const std::string& expected_title, |
30 bool http) { | 32 bool http) { |
31 GURL gurl; | 33 GURL gurl; |
32 std::string query = media::GetURLQueryString(query_params); | 34 std::string query = media::GetURLQueryString(query_params); |
33 scoped_ptr<net::SpawnedTestServer> http_test_server; | 35 scoped_ptr<net::SpawnedTestServer> http_test_server; |
34 if (http) { | 36 if (http) { |
35 http_test_server = media::StartMediaHttpTestServer(); | 37 http_test_server.reset( |
| 38 new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP, |
| 39 net::SpawnedTestServer::kLocalhost, |
| 40 media::GetTestDataPath())); |
| 41 CHECK(http_test_server->Start()); |
36 gurl = http_test_server->GetURL("files/" + html_page + "?" + query); | 42 gurl = http_test_server->GetURL("files/" + html_page + "?" + query); |
37 } else { | 43 } else { |
38 gurl = content::GetFileUrlWithQuery(media::GetTestDataFilePath(html_page), | 44 gurl = content::GetFileUrlWithQuery(media::GetTestDataFilePath(html_page), |
39 query); | 45 query); |
40 } | 46 } |
41 std::string final_title = RunTest(gurl, expected_title); | 47 std::string final_title = RunTest(gurl, expected_title); |
42 EXPECT_EQ(expected_title, final_title); | 48 EXPECT_EQ(expected_title, final_title); |
43 } | 49 } |
44 | 50 |
45 std::string MediaBrowserTest::RunTest(const GURL& gurl, | 51 std::string MediaBrowserTest::RunTest(const GURL& gurl, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 249 } |
244 | 250 |
245 #if defined(OS_CHROMEOS) | 251 #if defined(OS_CHROMEOS) |
246 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { | 252 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { |
247 RunColorFormatTest("yuv420p.avi", kEnded); | 253 RunColorFormatTest("yuv420p.avi", kEnded); |
248 } | 254 } |
249 #endif // defined(OS_CHROMEOS) | 255 #endif // defined(OS_CHROMEOS) |
250 #endif // defined(USE_PROPRIETARY_CODECS) | 256 #endif // defined(USE_PROPRIETARY_CODECS) |
251 | 257 |
252 } // namespace content | 258 } // namespace content |
OLD | NEW |