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

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

Issue 1411073005: Migrating tests to use EmbeddedTestServer (/content) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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"
11 #include "content/public/test/content_browser_test_utils.h" 11 #include "content/public/test/content_browser_test_utils.h"
12 #include "content/shell/browser/shell.h" 12 #include "content/shell/browser/shell.h"
13 #include "media/base/test_data_util.h" 13 #include "media/base/test_data_util.h"
14 #include "net/test/spawned_test_server/spawned_test_server.h" 14 #include "net/test/embedded_test_server/embedded_test_server.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // Common test results. 18 // Common test results.
19 const char MediaBrowserTest::kEnded[] = "ENDED"; 19 const char MediaBrowserTest::kEnded[] = "ENDED";
20 const char MediaBrowserTest::kError[] = "ERROR"; 20 const char MediaBrowserTest::kError[] = "ERROR";
21 const char MediaBrowserTest::kFailed[] = "FAILED"; 21 const char MediaBrowserTest::kFailed[] = "FAILED";
22 22
23 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, 23 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page,
24 const base::StringPairs& query_params, 24 const base::StringPairs& query_params,
25 const std::string& expected_title, 25 const std::string& expected_title,
26 bool http) { 26 bool http) {
27 GURL gurl; 27 GURL gurl;
28 std::string query = media::GetURLQueryString(query_params); 28 std::string query = media::GetURLQueryString(query_params);
29 scoped_ptr<net::SpawnedTestServer> http_test_server; 29 scoped_ptr<net::EmbeddedTestServer> http_test_server;
30 if (http) { 30 if (http) {
31 http_test_server.reset( 31 http_test_server.reset(new net::EmbeddedTestServer);
32 new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP, 32 http_test_server->ServeFilesFromSourceDirectory(media::GetTestDataPath());
33 net::SpawnedTestServer::kLocalhost,
34 media::GetTestDataPath()));
35 CHECK(http_test_server->Start()); 33 CHECK(http_test_server->Start());
36 gurl = http_test_server->GetURL("files/" + html_page + "?" + query); 34 gurl = http_test_server->GetURL("/" + html_page + "?" + query);
37 } else { 35 } else {
38 gurl = content::GetFileUrlWithQuery(media::GetTestDataFilePath(html_page), 36 gurl = content::GetFileUrlWithQuery(media::GetTestDataFilePath(html_page),
39 query); 37 query);
40 } 38 }
41 std::string final_title = RunTest(gurl, expected_title); 39 std::string final_title = RunTest(gurl, expected_title);
42 EXPECT_EQ(expected_title, final_title); 40 EXPECT_EQ(expected_title, final_title);
43 } 41 }
44 42
45 std::string MediaBrowserTest::RunTest(const GURL& gurl, 43 std::string MediaBrowserTest::RunTest(const GURL& gurl,
46 const std::string& expected_title) { 44 const std::string& expected_title) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 271 }
274 272
275 #if defined(OS_CHROMEOS) 273 #if defined(OS_CHROMEOS)
276 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { 274 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) {
277 RunColorFormatTest("yuv420p.avi", kEnded); 275 RunColorFormatTest("yuv420p.avi", kEnded);
278 } 276 }
279 #endif // defined(OS_CHROMEOS) 277 #endif // defined(OS_CHROMEOS)
280 #endif // defined(USE_PROPRIETARY_CODECS) 278 #endif // defined(USE_PROPRIETARY_CODECS)
281 279
282 } // namespace content 280 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_browsertest.h ('k') | content/browser/media/webrtc_audio_debug_recordings_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698