OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "courgette/base_test_unittest.h" | 5 #include "courgette/base_test_unittest.h" |
6 #include "courgette/image_info.h" | 6 #include "courgette/image_info.h" |
7 | 7 |
8 class ImageInfoTest : public BaseTest { | 8 class ImageInfoTest : public BaseTest { |
9 public: | 9 public: |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 EXPECT_EQ('M', p[0]); | 52 EXPECT_EQ('M', p[0]); |
53 EXPECT_EQ('Z', p[1]); | 53 EXPECT_EQ('Z', p[1]); |
54 } | 54 } |
55 | 55 |
56 void ImageInfoTest::TestResourceDll() const { | 56 void ImageInfoTest::TestResourceDll() const { |
57 std::string file1 = FileContents("en-US.dll"); | 57 std::string file1 = FileContents("en-US.dll"); |
58 | 58 |
59 scoped_ptr<courgette::PEInfo> info(new courgette::PEInfo()); | 59 scoped_ptr<courgette::PEInfo> info(new courgette::PEInfo()); |
60 info->Init(reinterpret_cast<const uint8*>(file1.c_str()), file1.length()); | 60 info->Init(reinterpret_cast<const uint8*>(file1.c_str()), file1.length()); |
61 | 61 |
| 62 // This is expected to fail, since we don't really support them yet. |
62 bool can_parse_header = info->ParseHeader(); | 63 bool can_parse_header = info->ParseHeader(); |
63 EXPECT_TRUE(can_parse_header); | 64 EXPECT_FALSE(can_parse_header); |
64 | 65 |
65 // The executable is the whole file, not 'embedded' with the file | 66 // The executable is the whole file, not 'embedded' with the file |
66 EXPECT_EQ(file1.length(), info->length()); | 67 EXPECT_EQ(file1.length(), info->length()); |
67 | 68 |
68 EXPECT_TRUE(info->ok()); | 69 EXPECT_FALSE(info->ok()); |
69 EXPECT_FALSE(info->has_text_section()); | 70 EXPECT_FALSE(info->has_text_section()); |
70 EXPECT_EQ(0U, info->size_of_code()); | 71 EXPECT_EQ(0U, info->size_of_code()); |
71 } | 72 } |
72 | 73 |
73 TEST_F(ImageInfoTest, All) { | 74 TEST_F(ImageInfoTest, All) { |
74 TestExe(); | 75 TestExe(); |
75 TestResourceDll(); | 76 TestResourceDll(); |
76 } | 77 } |
OLD | NEW |