Commit 2636d976 authored by anand.ratn's avatar anand.ratn Committed by Commit bot

Use base::StringPairs where appropriate for src/media/

Becuase base/strings/string_split.h defines:
typedef std::vector<std::pair<std::string, std::string> > StringPairs;

BUG=412250

Review URL: https://codereview.chromium.org/593023002

Cr-Commit-Position: refs/heads/master@{#297359}
parent 5530ca35
...@@ -118,9 +118,9 @@ class EncryptedMediaTestBase : public MediaBrowserTest { ...@@ -118,9 +118,9 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
void RunEncryptedMediaTestPage( void RunEncryptedMediaTestPage(
const std::string& html_page, const std::string& html_page,
const std::string& key_system, const std::string& key_system,
const media::QueryParams& query_params, base::StringPairs& query_params,
const std::string& expected_title) { const std::string& expected_title) {
media::QueryParams new_query_params = query_params; base::StringPairs new_query_params = query_params;
StartLicenseServerIfNeeded(key_system, &new_query_params); StartLicenseServerIfNeeded(key_system, &new_query_params);
RunMediaTestPage(html_page, new_query_params, expected_title, true); RunMediaTestPage(html_page, new_query_params, expected_title, true);
} }
...@@ -146,7 +146,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest { ...@@ -146,7 +146,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
VLOG(0) << "Skipping test - MSE not supported."; VLOG(0) << "Skipping test - MSE not supported.";
return; return;
} }
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair("mediaFile", media_file)); query_params.push_back(std::make_pair("mediaFile", media_file));
query_params.push_back(std::make_pair("mediaType", media_type)); query_params.push_back(std::make_pair("mediaType", media_type));
query_params.push_back(std::make_pair("keySystem", key_system)); query_params.push_back(std::make_pair("keySystem", key_system));
...@@ -193,7 +193,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest { ...@@ -193,7 +193,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
// Starts a license server if available for the |key_system| and adds a // Starts a license server if available for the |key_system| and adds a
// 'licenseServerURL' query parameter to |query_params|. // 'licenseServerURL' query parameter to |query_params|.
void StartLicenseServerIfNeeded(const std::string& key_system, void StartLicenseServerIfNeeded(const std::string& key_system,
media::QueryParams* query_params) { base::StringPairs* query_params) {
scoped_ptr<TestLicenseServerConfig> config = GetServerConfig(key_system); scoped_ptr<TestLicenseServerConfig> config = GetServerConfig(key_system);
if (!config) if (!config)
return; return;
...@@ -406,7 +406,7 @@ class EncryptedMediaTest ...@@ -406,7 +406,7 @@ class EncryptedMediaTest
void TestConfigChange() { void TestConfigChange() {
DCHECK(IsMSESupported()); DCHECK(IsMSESupported());
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
query_params.push_back(std::make_pair("runEncrypted", "1")); query_params.push_back(std::make_pair("runEncrypted", "1"));
if (CurrentEmeVersion() == PREFIXED) if (CurrentEmeVersion() == PREFIXED)
......
...@@ -28,7 +28,7 @@ MediaBrowserTest::~MediaBrowserTest() { ...@@ -28,7 +28,7 @@ MediaBrowserTest::~MediaBrowserTest() {
} }
void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, void MediaBrowserTest::RunMediaTestPage(const std::string& html_page,
const media::QueryParams& query_params, const base::StringPairs& query_params,
const std::string& expected_title, const std::string& expected_title,
bool http) { bool http) {
GURL gurl; GURL gurl;
......
...@@ -36,7 +36,7 @@ class MediaBrowserTest : public InProcessBrowserTest, ...@@ -36,7 +36,7 @@ class MediaBrowserTest : public InProcessBrowserTest,
// page, otherwise a local file URL is loaded inside the content shell. // page, otherwise a local file URL is loaded inside the content shell.
// It uses RunTest() to check for expected test output. // It uses RunTest() to check for expected test output.
void RunMediaTestPage(const std::string& html_page, void RunMediaTestPage(const std::string& html_page,
const media::QueryParams& query_params, const base::StringPairs& query_params,
const std::string& expected, const std::string& expected,
bool http); bool http);
......
...@@ -80,7 +80,7 @@ class EncryptedMediaTest : public content::MediaBrowserTest, ...@@ -80,7 +80,7 @@ class EncryptedMediaTest : public content::MediaBrowserTest,
return; return;
} }
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
query_params.push_back(std::make_pair("runEncrypted", "1")); query_params.push_back(std::make_pair("runEncrypted", "1"));
RunMediaTestPage("mse_config_change.html", query_params, kEnded, true); RunMediaTestPage("mse_config_change.html", query_params, kEnded, true);
...@@ -101,7 +101,7 @@ class EncryptedMediaTest : public content::MediaBrowserTest, ...@@ -101,7 +101,7 @@ class EncryptedMediaTest : public content::MediaBrowserTest,
return; return;
} }
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair("mediaFile", media_file)); query_params.push_back(std::make_pair("mediaFile", media_file));
query_params.push_back(std::make_pair("mediaType", media_type)); query_params.push_back(std::make_pair("mediaType", media_type));
query_params.push_back(std::make_pair("keySystem", key_system)); query_params.push_back(std::make_pair("keySystem", key_system));
......
...@@ -28,7 +28,7 @@ const char MediaBrowserTest::kError[] = "ERROR"; ...@@ -28,7 +28,7 @@ const char MediaBrowserTest::kError[] = "ERROR";
const char MediaBrowserTest::kFailed[] = "FAILED"; const char MediaBrowserTest::kFailed[] = "FAILED";
void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, void MediaBrowserTest::RunMediaTestPage(const std::string& html_page,
const media::QueryParams& query_params, const base::StringPairs& query_params,
const std::string& expected_title, const std::string& expected_title,
bool http) { bool http) {
GURL gurl; GURL gurl;
...@@ -94,7 +94,7 @@ class MediaTest : public testing::WithParamInterface<bool>, ...@@ -94,7 +94,7 @@ class MediaTest : public testing::WithParamInterface<bool>,
void PlayMedia(const std::string& tag, void PlayMedia(const std::string& tag,
const std::string& media_file, const std::string& media_file,
bool http) { bool http) {
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair(tag, media_file)); query_params.push_back(std::make_pair(tag, media_file));
RunMediaTestPage("player.html", query_params, kEnded, http); RunMediaTestPage("player.html", query_params, kEnded, http);
} }
...@@ -104,7 +104,7 @@ class MediaTest : public testing::WithParamInterface<bool>, ...@@ -104,7 +104,7 @@ class MediaTest : public testing::WithParamInterface<bool>,
expected += base::IntToString(width); expected += base::IntToString(width);
expected += " "; expected += " ";
expected += base::IntToString(height); expected += base::IntToString(height);
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair("video", media_file)); query_params.push_back(std::make_pair("video", media_file));
RunMediaTestPage("player.html", query_params, expected, false); RunMediaTestPage("player.html", query_params, expected, false);
} }
......
...@@ -29,7 +29,7 @@ class MediaBrowserTest : public ContentBrowserTest { ...@@ -29,7 +29,7 @@ class MediaBrowserTest : public ContentBrowserTest {
// page, otherwise a local file URL is loaded inside the content shell. // page, otherwise a local file URL is loaded inside the content shell.
// It uses RunTest() to check for expected test output. // It uses RunTest() to check for expected test output.
void RunMediaTestPage(const std::string& html_page, void RunMediaTestPage(const std::string& html_page,
const media::QueryParams& query_params, const base::StringPairs& query_params,
const std::string& expected, const std::string& expected,
bool http); bool http);
......
...@@ -40,7 +40,7 @@ class MediaSourceTest : public content::MediaBrowserTest { ...@@ -40,7 +40,7 @@ class MediaSourceTest : public content::MediaBrowserTest {
return; return;
} }
media::QueryParams query_params; base::StringPairs query_params;
query_params.push_back(std::make_pair("mediaFile", media_file)); query_params.push_back(std::make_pair("mediaFile", media_file));
query_params.push_back(std::make_pair("mediaType", media_type)); query_params.push_back(std::make_pair("mediaType", media_type));
RunMediaTestPage("media_source_player.html", query_params, expectation, RunMediaTestPage("media_source_player.html", query_params, expectation,
...@@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { ...@@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) {
return; return;
} }
RunMediaTestPage("mse_config_change.html", RunMediaTestPage("mse_config_change.html",
media::QueryParams(), base::StringPairs(),
kEnded, kEnded,
true); true);
} }
......
...@@ -25,9 +25,9 @@ base::FilePath GetTestDataPath() { ...@@ -25,9 +25,9 @@ base::FilePath GetTestDataPath() {
return base::FilePath(kTestDataPath); return base::FilePath(kTestDataPath);
} }
std::string GetURLQueryString(const QueryParams& query_params) { std::string GetURLQueryString(const base::StringPairs& query_params) {
std::string query = ""; std::string query = "";
QueryParams::const_iterator itr = query_params.begin(); base::StringPairs::const_iterator itr = query_params.begin();
for (; itr != query_params.end(); ++itr) { for (; itr != query_params.end(); ++itr) {
if (itr != query_params.begin()) if (itr != query_params.begin())
query.append("&"); query.append("&");
......
...@@ -13,13 +13,12 @@ ...@@ -13,13 +13,12 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/strings/string_split.h"
namespace media { namespace media {
class DecoderBuffer; class DecoderBuffer;
typedef std::vector<std::pair<std::string, std::string> > QueryParams;
// Returns a file path for a file in the media/test/data directory. // Returns a file path for a file in the media/test/data directory.
base::FilePath GetTestDataFilePath(const std::string& name); base::FilePath GetTestDataFilePath(const std::string& name);
...@@ -28,7 +27,7 @@ base::FilePath GetTestDataPath(); ...@@ -28,7 +27,7 @@ base::FilePath GetTestDataPath();
// Returns a string containing key value query params in the form of: // Returns a string containing key value query params in the form of:
// "key_1=value_1&key_2=value2" // "key_1=value_1&key_2=value2"
std::string GetURLQueryString(const QueryParams& query_params); std::string GetURLQueryString(const base::StringPairs& query_params);
// Reads a test file from media/test/data directory and stores it in // Reads a test file from media/test/data directory and stores it in
// a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter // a DecoderBuffer. Use DecoderBuffer vs DataBuffer to ensure no matter
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment