OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/files/memory_mapped_file.h" | 6 #include "base/files/memory_mapped_file.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "media/base/test_data_util.h" | 8 #include "media/base/test_data_util.h" |
9 #include "media/filters/jpeg_parser.h" | 9 #include "media/filters/jpeg_parser.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 EXPECT_EQ(1, result.scan.components[0].component_selector); | 69 EXPECT_EQ(1, result.scan.components[0].component_selector); |
70 EXPECT_EQ(0, result.scan.components[0].dc_selector); | 70 EXPECT_EQ(0, result.scan.components[0].dc_selector); |
71 EXPECT_EQ(0, result.scan.components[0].ac_selector); | 71 EXPECT_EQ(0, result.scan.components[0].ac_selector); |
72 EXPECT_EQ(2, result.scan.components[1].component_selector); | 72 EXPECT_EQ(2, result.scan.components[1].component_selector); |
73 EXPECT_EQ(1, result.scan.components[1].dc_selector); | 73 EXPECT_EQ(1, result.scan.components[1].dc_selector); |
74 EXPECT_EQ(1, result.scan.components[1].ac_selector); | 74 EXPECT_EQ(1, result.scan.components[1].ac_selector); |
75 EXPECT_EQ(3, result.scan.components[2].component_selector); | 75 EXPECT_EQ(3, result.scan.components[2].component_selector); |
76 EXPECT_EQ(1, result.scan.components[2].dc_selector); | 76 EXPECT_EQ(1, result.scan.components[2].dc_selector); |
77 EXPECT_EQ(1, result.scan.components[2].ac_selector); | 77 EXPECT_EQ(1, result.scan.components[2].ac_selector); |
78 EXPECT_EQ(121150u, result.data_size); | 78 EXPECT_EQ(121150u, result.data_size); |
| 79 EXPECT_EQ(121358u, result.image_size); |
79 } | 80 } |
80 | 81 |
81 TEST(JpegParserTest, CodedSizeNotEqualVisibleSize) { | 82 TEST(JpegParserTest, CodedSizeNotEqualVisibleSize) { |
82 base::FilePath data_dir; | 83 base::FilePath data_dir; |
83 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); | 84 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); |
84 | 85 |
85 base::FilePath file_path = data_dir.AppendASCII("media") | 86 base::FilePath file_path = data_dir.AppendASCII("media") |
86 .AppendASCII("test") | 87 .AppendASCII("test") |
87 .AppendASCII("data") | 88 .AppendASCII("data") |
88 .AppendASCII("blank-1x1.jpg"); | 89 .AppendASCII("blank-1x1.jpg"); |
(...skipping 14 matching lines...) Expand all Loading... |
103 EXPECT_EQ(2, result.frame_header.components[0].vertical_sampling_factor); | 104 EXPECT_EQ(2, result.frame_header.components[0].vertical_sampling_factor); |
104 } | 105 } |
105 | 106 |
106 TEST(JpegParserTest, ParsingFail) { | 107 TEST(JpegParserTest, ParsingFail) { |
107 const uint8_t data[] = {0, 1, 2, 3}; // not jpeg | 108 const uint8_t data[] = {0, 1, 2, 3}; // not jpeg |
108 JpegParseResult result; | 109 JpegParseResult result; |
109 ASSERT_FALSE(ParseJpegPicture(data, sizeof(data), &result)); | 110 ASSERT_FALSE(ParseJpegPicture(data, sizeof(data), &result)); |
110 } | 111 } |
111 | 112 |
112 } // namespace media | 113 } // namespace media |
OLD | NEW |