| Index: content/common/gpu/media/vaapi_jpeg_parser_unittest.cc
|
| diff --git a/content/common/gpu/media/vaapi_jpeg_parser_unittest.cc b/content/common/gpu/media/vaapi_jpeg_parser_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..be06fff6d8977d1dfd83302d71f59f5f1867b6b8
|
| --- /dev/null
|
| +++ b/content/common/gpu/media/vaapi_jpeg_parser_unittest.cc
|
| @@ -0,0 +1,59 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/at_exit.h"
|
| +#include "base/files/memory_mapped_file.h"
|
| +#include "base/path_service.h"
|
| +#include "content/common/gpu/media/vaapi_jpeg_parser.h"
|
| +#include "media/base/test_data_util.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace content {
|
| +
|
| +TEST(VaapiJpegParserTest, Parsing) {
|
| + base::FilePath data_dir;
|
| + ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir));
|
| + data_dir = data_dir.AppendASCII("content")
|
| + .AppendASCII("test")
|
| + .AppendASCII("data")
|
| + .AppendASCII("jpeg");
|
| +
|
| + // This sample frame is captured from Chromebook Pixel
|
| + base::FilePath file_path = data_dir.AppendASCII("pixel-1280x720.bin");
|
| +
|
| + base::MemoryMappedFile stream;
|
| + ASSERT_TRUE(stream.Initialize(file_path))
|
| + << "Couldn't open stream file: " << file_path.MaybeAsASCII();
|
| +
|
| + VaapiJpegParser parser(stream.data(), stream.length());
|
| +
|
| + const JpegParseResult* result = parser.Parse();
|
| + ASSERT_TRUE(result != NULL);
|
| +
|
| + // Verify selected fields
|
| + // SOF fields
|
| + EXPECT_EQ(result->visible_width, 1280);
|
| + EXPECT_EQ(result->visible_height, 720);
|
| + EXPECT_EQ(result->num_component, 3);
|
| + EXPECT_EQ(result->components[0].id, 1);
|
| + EXPECT_EQ(result->components[1].id, 2);
|
| + EXPECT_EQ(result->components[2].id, 3);
|
| +
|
| + // DQT fields
|
| + EXPECT_TRUE(result->q_table[0].valid);
|
| + EXPECT_TRUE(result->q_table[1].valid);
|
| +
|
| + // SOS fields
|
| + EXPECT_EQ(result->scan.components[1].dc_selector, 1);
|
| + EXPECT_EQ(result->scan.components[1].ac_selector, 1);
|
| + EXPECT_EQ(result->scan.data_size, 121150u);
|
| +}
|
| +
|
| +} // namespace content
|
| +
|
| +int main(int argc, char** argv) {
|
| + testing::InitGoogleTest(&argc, argv);
|
| + base::AtExitManager exit_manager;
|
| + return RUN_ALL_TESTS();
|
| +}
|
|
|