Chromium Code Reviews| 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..1869444622cfe750488b8895b0750fbe0183da54 100644 |
| --- a/chrome/browser/media/media_browsertest.cc |
| +++ b/chrome/browser/media/media_browsertest.cc |
| @@ -15,6 +15,7 @@ |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/test/browser_test_utils.h" |
| +#include "media/base/test_data_util.h" |
| // Common test results. |
| const char MediaBrowserTest::kEnded[] = "ENDED"; |
| @@ -29,8 +30,10 @@ MediaBrowserTest::~MediaBrowserTest() { |
| } |
| void MediaBrowserTest::RunMediaTestPage( |
| - const std::string& html_page, std::vector<StringPair>* query_params, |
| - const std::string& expected_title, bool http) { |
| + const std::string& html_page, |
| + std::vector<StringPair>* query_params, |
| + const std::string& expected_title, |
| + bool http) { |
| GURL gurl; |
| std::string query = ""; |
| if (query_params != NULL && !query_params->empty()) { |
| @@ -41,24 +44,25 @@ void MediaBrowserTest::RunMediaTestPage( |
| query.append("&" + itr->first + "=" + itr->second); |
| } |
| } |
| + 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_.reset(new net::SpawnedTestServer( |
| + net::SpawnedTestServer::TYPE_HTTP, |
| + net::SpawnedTestServer::kLocalhost, |
| + media::GetTestDataPath())); |
| + ASSERT_TRUE(http_test_server_.get()->Start()); |
|
jrummell
2014/07/02 00:33:40
nit: you don't need .get() here and next line.
shadi
2014/07/02 19:23:36
Done.
|
| + gurl = http_test_server_.get()->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); |
| } |
| base::string16 MediaBrowserTest::RunTest(const GURL& gurl, |
| const std::string& expected_title) { |
| - VLOG(0) << "Running test URL: " << gurl; |
| + DVLOG(0) << "Running test URL: " << gurl; |
| // Observe the web contents for plugin crashes. |
| Observe(browser()->tab_strip_model()->GetActiveWebContents()); |
| content::TitleWatcher title_watcher( |