Index: chrome/browser/media/media_browsertest.cc |
diff --git a/chrome/browser/media/media_browsertest.cc b/chrome/browser/media/media_browsertest.cc |
index cf0195e5fee05e703aef2b8ea7e34b7177598d72..aca81db7a572e5ba97155ed827c489a89a42abe0 100644 |
--- a/chrome/browser/media/media_browsertest.cc |
+++ b/chrome/browser/media/media_browsertest.cc |
@@ -4,12 +4,9 @@ |
#include "chrome/browser/media/media_browsertest.h" |
-#include "base/path_service.h" |
-#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
-#include "chrome/common/chrome_paths.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/navigation_entry.h" |
@@ -28,37 +25,27 @@ MediaBrowserTest::MediaBrowserTest() : ignore_plugin_crash_(false) { |
MediaBrowserTest::~MediaBrowserTest() { |
} |
-void MediaBrowserTest::RunMediaTestPage( |
- const std::string& html_page, std::vector<StringPair>* query_params, |
- const std::string& expected_title, bool http) { |
+void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, |
+ const media::QueryParams& query_params, |
+ const std::string& expected_title, |
+ bool http) { |
GURL gurl; |
- std::string query = ""; |
- if (query_params != NULL && !query_params->empty()) { |
- std::vector<StringPair>::const_iterator itr = query_params->begin(); |
- query = itr->first + "=" + itr->second; |
- ++itr; |
- for (; itr != query_params->end(); ++itr) { |
- query.append("&" + itr->first + "=" + itr->second); |
- } |
- } |
+ std::string query = media::GetURLQueryString(query_params); |
+ scoped_ptr<net::SpawnedTestServer> http_test_server; |
if (http) { |
- ASSERT_TRUE(test_server()->Start()); |
- gurl = test_server()->GetURL("files/media/" + html_page + "?" + query); |
+ http_test_server = media::StartMediaHttpTestServer(); |
+ gurl = http_test_server->GetURL("files/" + html_page + "?" + query); |
} else { |
- base::FilePath test_file_path; |
- PathService::Get(chrome::DIR_TEST_DATA, &test_file_path); |
- test_file_path = test_file_path.AppendASCII("media") |
- .AppendASCII(html_page); |
- gurl = content::GetFileUrlWithQuery(test_file_path, query); |
+ gurl = content::GetFileUrlWithQuery(media::GetTestDataFilePath(html_page), |
+ query); |
} |
- |
- base::string16 final_title = RunTest(gurl, expected_title); |
- EXPECT_EQ(base::ASCIIToUTF16(expected_title), final_title); |
+ std::string final_title = RunTest(gurl, expected_title); |
+ EXPECT_EQ(expected_title, final_title); |
} |
-base::string16 MediaBrowserTest::RunTest(const GURL& gurl, |
- const std::string& expected_title) { |
- VLOG(0) << "Running test URL: " << gurl; |
+std::string MediaBrowserTest::RunTest(const GURL& gurl, |
+ const std::string& expected_title) { |
+ DVLOG(0) << "Running test URL: " << gurl; |
// Observe the web contents for plugin crashes. |
Observe(browser()->tab_strip_model()->GetActiveWebContents()); |
content::TitleWatcher title_watcher( |
@@ -66,8 +53,8 @@ base::string16 MediaBrowserTest::RunTest(const GURL& gurl, |
base::ASCIIToUTF16(expected_title)); |
AddWaitForTitles(&title_watcher); |
ui_test_utils::NavigateToURL(browser(), gurl); |
- |
- return title_watcher.WaitAndGetTitle(); |
+ base::string16 result = title_watcher.WaitAndGetTitle(); |
+ return base::UTF16ToASCII(result); |
} |
void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { |