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

Unified Diff: chrome/browser/media/media_browsertest.cc

Issue 357413002: Have media content and chrome browser tests load data from media/test/data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: few merge fixes Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698