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

Unified Diff: media/filters/h264_parser_unittest.cc

Issue 119153002: Move H264Parser and H264BitReader to media/filters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test-25fps.h264 to isolate Created 7 years 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: media/filters/h264_parser_unittest.cc
diff --git a/content/common/gpu/media/h264_parser_unittest.cc b/media/filters/h264_parser_unittest.cc
similarity index 66%
rename from content/common/gpu/media/h264_parser_unittest.cc
rename to media/filters/h264_parser_unittest.cc
index d52bb5122094f519f409cd453af2245393092326..53f7214a950a63260dcaef8a69a9bc6534429f18 100644
--- a/content/common/gpu/media/h264_parser_unittest.cc
+++ b/media/filters/h264_parser_unittest.cc
@@ -2,16 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "testing/gtest/include/gtest/gtest.h"
-
#include "base/command_line.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
+#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
-#include "content/common/gpu/media/h264_parser.h"
+#include "media/base/test_data_util.h"
+#include "media/filters/h264_parser.h"
+#include "testing/gtest/include/gtest/gtest.h"
-using content::H264Parser;
-using content::H264NALU;
+using media::H264Parser;
scherkus (not reviewing) 2014/01/06 20:10:12 ditto
Pawel Osciak 2014/01/08 07:30:34 Done.
+using media::H264NALU;
const base::FilePath::CharType* test_stream_filename =
FILE_PATH_LITERAL("content/common/gpu/testdata/test-25fps.h264");
@@ -19,10 +20,13 @@ const base::FilePath::CharType* test_stream_filename =
int num_nalus = 759;
TEST(H264ParserTest, StreamFileParsing) {
- base::FilePath fp(test_stream_filename);
+ base::FilePath file_path;
+ CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path));
+
+ file_path = file_path.Append(test_stream_filename);
base::MemoryMappedFile stream;
- CHECK(stream.Initialize(fp)) << "Couldn't open stream file: "
- << test_stream_filename;
+ ASSERT_TRUE(stream.Initialize(file_path))
+ << "Couldn't open stream file: " << file_path.MaybeAsASCII();
DVLOG(1) << "Parsing file: " << test_stream_filename;
H264Parser parser;
@@ -31,8 +35,8 @@ TEST(H264ParserTest, StreamFileParsing) {
// Parse until the end of stream/unsupported stream/error in stream is found.
int num_parsed_nalus = 0;
while (true) {
- content::H264SliceHeader shdr;
- content::H264SEIMessage sei_msg;
+ media::H264SliceHeader shdr;
+ media::H264SEIMessage sei_msg;
H264NALU nalu;
H264Parser::Result res = parser.AdvanceToNextNALU(&nalu);
if (res == H264Parser::kEOStream) {
@@ -71,23 +75,3 @@ TEST(H264ParserTest, StreamFileParsing) {
}
}
}
-
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- CommandLine::Init(argc, argv);
-
- const CommandLine::SwitchMap& switches =
- CommandLine::ForCurrentProcess()->GetSwitches();
- for (CommandLine::SwitchMap::const_iterator it = switches.begin();
- it != switches.end(); ++it) {
- if (it->first == "test_stream") {
- test_stream_filename = it->second.c_str();
- } else if (it->first == "num_nalus") {
- CHECK(base::StringToInt(it->second, &num_nalus));
- } else {
- LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
- }
- }
-
- return RUN_ALL_TESTS();
-}

Powered by Google App Engine
This is Rietveld 408576698