OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "chrome/utility/media_galleries/image_metadata_extractor.h" | 10 #include "chrome/utility/media_galleries/image_metadata_extractor.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 EXPECT_TRUE(source.Initialize(GetTestDataFilePath(filename))); | 37 EXPECT_TRUE(source.Initialize(GetTestDataFilePath(filename))); |
38 | 38 |
39 scoped_ptr<ImageMetadataExtractor> extractor(new ImageMetadataExtractor); | 39 scoped_ptr<ImageMetadataExtractor> extractor(new ImageMetadataExtractor); |
40 | 40 |
41 base::RunLoop loop; | 41 base::RunLoop loop; |
42 bool extracted = false; | 42 bool extracted = false; |
43 extractor->Extract(&source, base::Bind(&QuitLoop, &loop, &extracted)); | 43 extractor->Extract(&source, base::Bind(&QuitLoop, &loop, &extracted)); |
44 EXPECT_EQ(expected_result, extracted); | 44 EXPECT_EQ(expected_result, extracted); |
45 | 45 |
46 return extractor.Pass(); | 46 return extractor; |
47 } | 47 } |
48 | 48 |
49 TEST(ImageMetadataExtractorTest, JPGFile) { | 49 TEST(ImageMetadataExtractorTest, JPGFile) { |
50 scoped_ptr<ImageMetadataExtractor> extractor = | 50 scoped_ptr<ImageMetadataExtractor> extractor = |
51 GetExtractor("test.jpg", true); | 51 GetExtractor("test.jpg", true); |
52 | 52 |
53 EXPECT_EQ(5616, extractor->width()); | 53 EXPECT_EQ(5616, extractor->width()); |
54 EXPECT_EQ(3744, extractor->height()); | 54 EXPECT_EQ(3744, extractor->height()); |
55 EXPECT_EQ(0, extractor->rotation()); | 55 EXPECT_EQ(0, extractor->rotation()); |
56 EXPECT_EQ(300.0, extractor->x_resolution()); | 56 EXPECT_EQ(300.0, extractor->x_resolution()); |
(...skipping 10 matching lines...) Expand all Loading... |
67 | 67 |
68 TEST(ImageMetadataExtractorTest, PNGFile) { | 68 TEST(ImageMetadataExtractorTest, PNGFile) { |
69 GetExtractor("test.png", false); | 69 GetExtractor("test.png", false); |
70 } | 70 } |
71 | 71 |
72 TEST(ImageMetadataExtractorTest, NonImageFile) { | 72 TEST(ImageMetadataExtractorTest, NonImageFile) { |
73 GetExtractor("test.js", false); | 73 GetExtractor("test.js", false); |
74 } | 74 } |
75 | 75 |
76 } // namespace metadata | 76 } // namespace metadata |
OLD | NEW |