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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void EncodeDecodeTest::TestExe(const char* file_name) const { | 46 void EncodeDecodeTest::TestExe(const char* file_name) const { |
47 // Test top-level Courgette API for converting an a file to a binary | 47 // Test top-level Courgette API for converting an a file to a binary |
48 // assembly representation and back. | 48 // assembly representation and back. |
49 std::string file1 = FileContents(file_name); | 49 std::string file1 = FileContents(file_name); |
50 | 50 |
51 const void* original_buffer = file1.c_str(); | 51 const void* original_buffer = file1.c_str(); |
52 size_t original_length = file1.size(); | 52 size_t original_length = file1.size(); |
53 | 53 |
54 courgette::AssemblyProgram* program = NULL; | 54 courgette::AssemblyProgram* program = NULL; |
55 const courgette::Status parse_status = | 55 const courgette::Status parse_status = |
56 courgette::ParseWin32X86PE(original_buffer, original_length, &program); | 56 courgette::ParseDetectedExecutable(original_buffer, original_length, |
| 57 &program); |
57 EXPECT_EQ(courgette::C_OK, parse_status); | 58 EXPECT_EQ(courgette::C_OK, parse_status); |
58 | 59 |
59 courgette::EncodedProgram* encoded = NULL; | 60 courgette::EncodedProgram* encoded = NULL; |
60 | 61 |
61 const courgette::Status encode_status = Encode(program, &encoded); | 62 const courgette::Status encode_status = Encode(program, &encoded); |
62 EXPECT_EQ(courgette::C_OK, encode_status); | 63 EXPECT_EQ(courgette::C_OK, encode_status); |
63 | 64 |
64 DeleteAssemblyProgram(program); | 65 DeleteAssemblyProgram(program); |
65 | 66 |
66 courgette::SinkStreamSet sinks; | 67 courgette::SinkStreamSet sinks; |
(...skipping 29 matching lines...) Expand all Loading... |
96 EXPECT_EQ(original_length, assembled_length); | 97 EXPECT_EQ(original_length, assembled_length); |
97 EXPECT_EQ(0, memcmp(original_buffer, assembled_buffer, original_length)); | 98 EXPECT_EQ(0, memcmp(original_buffer, assembled_buffer, original_length)); |
98 | 99 |
99 DeleteEncodedProgram(encoded2); | 100 DeleteEncodedProgram(encoded2); |
100 } | 101 } |
101 | 102 |
102 | 103 |
103 TEST_F(EncodeDecodeTest, All) { | 104 TEST_F(EncodeDecodeTest, All) { |
104 TestExe("setup1.exe"); | 105 TestExe("setup1.exe"); |
105 } | 106 } |
OLD | NEW |