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

Side by Side Diff: content/common/gpu/media/vaapi_jpeg_parser_unittest.cc

Issue 748023002: Add JPEG parser for JPEG decode acceleration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/at_exit.h"
6 #include "base/files/memory_mapped_file.h"
7 #include "base/path_service.h"
8 #include "content/common/gpu/media/vaapi_jpeg_parser.h"
9 #include "media/base/test_data_util.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace content {
13
14 TEST(VaapiJpegParserTest, Parsing) {
wuchengli 2014/12/08 09:25:11 Is there any Parse() failure case worth testing?
15 base::FilePath data_dir;
16 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir));
17 data_dir = data_dir.AppendASCII("content")
18 .AppendASCII("test")
19 .AppendASCII("data")
20 .AppendASCII("jpeg");
21
22 // This sample frame is captured from Chromebook Pixel
23 base::FilePath file_path = data_dir.AppendASCII("pixel-1280x720.bin");
wuchengli 2014/12/08 09:25:11 Combine this with previous statement. base::FilePa
24
25 base::MemoryMappedFile stream;
26 ASSERT_TRUE(stream.Initialize(file_path))
27 << "Couldn't open stream file: " << file_path.MaybeAsASCII();
28
29 VaapiJpegParser parser(stream.data(), stream.length());
30
31 ASSERT_TRUE(parser.Parse());
32
33 const JpegParseResult* result = parser.GetParsedResult();
34
35 // Verify selected fields
36 // SOF fields
37 ASSERT_EQ(result->visible_width, 1280);
wuchengli 2014/12/08 09:25:11 Use EXPECT_ for all the following cases to verify
kcwu 2014/12/16 06:23:55 Done.
38 ASSERT_EQ(result->visible_height, 720);
39 ASSERT_EQ(result->num_component, 3);
40 ASSERT_EQ(result->components[0].id, 1);
41 ASSERT_EQ(result->components[1].id, 2);
42 ASSERT_EQ(result->components[2].id, 3);
43
44 // DQT fields
45 ASSERT_TRUE(result->q_table[0].valid);
46 ASSERT_TRUE(result->q_table[1].valid);
47
48 // SOS fields
49 ASSERT_EQ(result->scan.components[1].dc_selector, 1);
50 ASSERT_EQ(result->scan.components[1].ac_selector, 1);
51 ASSERT_EQ(result->scan.data_size, 121150u);
wuchengli 2014/12/08 09:25:11 You should verify all or most the fields in vaapi_
52 }
53
54 } // namespace content
55
56 int main(int argc, char** argv) {
57 testing::InitGoogleTest(&argc, argv);
58 base::AtExitManager exit_manager;
59 return RUN_ALL_TESTS();
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698