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

Side by Side Diff: courgette/encode_decode_unittest.cc

Issue 7920004: Start refactoring to reduce executable type knowledge. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix windows compile warning. Created 9 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « courgette/disassembler_win32_x86.cc ('k') | courgette/encoded_program_fuzz_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « courgette/disassembler_win32_x86.cc ('k') | courgette/encoded_program_fuzz_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698