Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: content/browser/media/media_browsertest.cc

Issue 593023002: Use base::StringPairs where appropriate for src/media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.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/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 10 matching lines...) Expand all
21 #endif 21 #endif
22 22
23 namespace content { 23 namespace content {
24 24
25 // Common test results. 25 // Common test results.
26 const char MediaBrowserTest::kEnded[] = "ENDED"; 26 const char MediaBrowserTest::kEnded[] = "ENDED";
27 const char MediaBrowserTest::kError[] = "ERROR"; 27 const char MediaBrowserTest::kError[] = "ERROR";
28 const char MediaBrowserTest::kFailed[] = "FAILED"; 28 const char MediaBrowserTest::kFailed[] = "FAILED";
29 29
30 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, 30 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page,
31 const media::QueryParams& query_params, 31 const base::StringPairs& query_params,
32 const std::string& expected_title, 32 const std::string& expected_title,
33 bool http) { 33 bool http) {
34 GURL gurl; 34 GURL gurl;
35 std::string query = media::GetURLQueryString(query_params); 35 std::string query = media::GetURLQueryString(query_params);
36 scoped_ptr<net::SpawnedTestServer> http_test_server; 36 scoped_ptr<net::SpawnedTestServer> http_test_server;
37 if (http) { 37 if (http) {
38 http_test_server.reset( 38 http_test_server.reset(
39 new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP, 39 new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP,
40 net::SpawnedTestServer::kLocalhost, 40 net::SpawnedTestServer::kLocalhost,
41 media::GetTestDataPath())); 41 media::GetTestDataPath()));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void RunColorFormatTest(const std::string& media_file, 87 void RunColorFormatTest(const std::string& media_file,
88 const std::string& expected) { 88 const std::string& expected) {
89 base::FilePath test_file_path = 89 base::FilePath test_file_path =
90 media::GetTestDataFilePath("blackwhite.html"); 90 media::GetTestDataFilePath("blackwhite.html");
91 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected); 91 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected);
92 } 92 }
93 93
94 void PlayMedia(const std::string& tag, 94 void PlayMedia(const std::string& tag,
95 const std::string& media_file, 95 const std::string& media_file,
96 bool http) { 96 bool http) {
97 media::QueryParams query_params; 97 base::StringPairs query_params;
98 query_params.push_back(std::make_pair(tag, media_file)); 98 query_params.push_back(std::make_pair(tag, media_file));
99 RunMediaTestPage("player.html", query_params, kEnded, http); 99 RunMediaTestPage("player.html", query_params, kEnded, http);
100 } 100 }
101 101
102 void RunVideoSizeTest(const char* media_file, int width, int height) { 102 void RunVideoSizeTest(const char* media_file, int width, int height) {
103 std::string expected; 103 std::string expected;
104 expected += base::IntToString(width); 104 expected += base::IntToString(width);
105 expected += " "; 105 expected += " ";
106 expected += base::IntToString(height); 106 expected += base::IntToString(height);
107 media::QueryParams query_params; 107 base::StringPairs query_params;
108 query_params.push_back(std::make_pair("video", media_file)); 108 query_params.push_back(std::make_pair("video", media_file));
109 RunMediaTestPage("player.html", query_params, expected, false); 109 RunMediaTestPage("player.html", query_params, expected, false);
110 } 110 }
111 }; 111 };
112 112
113 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { 113 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) {
114 PlayVideo("bear.ogv", GetParam()); 114 PlayVideo("bear.ogv", GetParam());
115 } 115 }
116 116
117 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { 117 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 277
278 #if defined(OS_CHROMEOS) 278 #if defined(OS_CHROMEOS)
279 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { 279 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) {
280 RunColorFormatTest("yuv420p.avi", kEnded); 280 RunColorFormatTest("yuv420p.avi", kEnded);
281 } 281 }
282 #endif // defined(OS_CHROMEOS) 282 #endif // defined(OS_CHROMEOS)
283 #endif // defined(USE_PROPRIETARY_CODECS) 283 #endif // defined(USE_PROPRIETARY_CODECS)
284 284
285 } // namespace content 285 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_browsertest.h ('k') | content/browser/media/media_source_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698