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

Side by Side Diff: courgette/adjustment_method_unittest.cc

Issue 2583373002: [Courgette] Simple AssemblyProgram and Disassembler cleanups. (Closed)
Patch Set: Tune up header inclusion. Created 3 years, 11 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
« no previous file with comments | « no previous file | courgette/assembly_program.h » ('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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/strings/string_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "courgette/assembly_program.h" 12 #include "courgette/assembly_program.h"
13 #include "courgette/courgette.h" 13 #include "courgette/courgette.h"
14 #include "courgette/encoded_program.h" 14 #include "courgette/encoded_program.h"
15 #include "courgette/image_utils.h" 15 #include "courgette/image_utils.h"
16 #include "courgette/streams.h" 16 #include "courgette/streams.h"
17 17
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace courgette { 20 namespace courgette {
21 21
22 namespace { 22 namespace {
23 23
24 class AdjustmentMethodTest : public testing::Test { 24 class AdjustmentMethodTest : public testing::Test {
25 public: 25 public:
26 void Test1() const; 26 void Test1() const;
27 27
28 private: 28 private:
29 void SetUp() { 29 void SetUp() {
30 } 30 }
31 31
32 void TearDown() { 32 void TearDown() {
33 } 33 }
34 34
35 // Returns one of two similar simple programs. These differ only in Label 35 // Returns one of two similar simple programs. These differ only in Label
36 // assignment, so it is possible to make them look identical. 36 // assignment, so it is possible to make them look identical.
37 std::unique_ptr<AssemblyProgram> MakeProgram(int kind) const { 37 std::unique_ptr<AssemblyProgram> MakeProgram(int kind) const {
38 std::unique_ptr<AssemblyProgram> prog(new AssemblyProgram(EXE_WIN_32_X86)); 38 auto prog = base::MakeUnique<AssemblyProgram>(EXE_WIN_32_X86, 0x00400000);
39 prog->set_image_base(0x00400000);
40 39
41 RVA kRvaA = 0x00410000; 40 RVA kRvaA = 0x00410000;
42 RVA kRvaB = 0x00410004; 41 RVA kRvaB = 0x00410004;
43 42
44 std::vector<RVA> abs32_rvas; 43 std::vector<RVA> abs32_rvas;
45 abs32_rvas.push_back(kRvaA); 44 abs32_rvas.push_back(kRvaA);
46 abs32_rvas.push_back(kRvaB); 45 abs32_rvas.push_back(kRvaB);
47 std::vector<RVA> rel32_rvas; // Stub. 46 std::vector<RVA> rel32_rvas; // Stub.
48 47
49 TrivialRvaVisitor abs32_visitor(abs32_rvas); 48 TrivialRvaVisitor abs32_visitor(abs32_rvas);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 EXPECT_TRUE(s5 == s6); // Adjustment did change B into A 131 EXPECT_TRUE(s5 == s6); // Adjustment did change B into A
133 } 132 }
134 133
135 TEST_F(AdjustmentMethodTest, All) { 134 TEST_F(AdjustmentMethodTest, All) {
136 Test1(); 135 Test1();
137 } 136 }
138 137
139 } // namespace 138 } // namespace
140 139
141 } // namespace courgette 140 } // namespace courgette
OLDNEW
« no previous file with comments | « no previous file | courgette/assembly_program.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698