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

Side by Side Diff: courgette/adjustment_method_unittest.cc

Issue 2583373002: [Courgette] Simple AssemblyProgram and Disassembler cleanups. (Closed)
Patch Set: Sync. 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') | courgette/assembly_program.h » ('J')
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/strings/string_util.h"
grt (UTC plus 2) 2017/01/12 11:56:40 unused?
huangs 2017/01/12 19:54:41 Removed.
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 std::unique_ptr<AssemblyProgram> prog(
39 prog->set_image_base(0x00400000); 39 new AssemblyProgram(EXE_WIN_32_X86, 0x00400000));
grt (UTC plus 2) 2017/01/12 11:56:40 nit: auto prog = base::MakeUnique<AssemblyProg
huangs 2017/01/12 19:54:41 Done.
40 40
41 RVA kRvaA = 0x00410000; 41 RVA kRvaA = 0x00410000;
42 RVA kRvaB = 0x00410004; 42 RVA kRvaB = 0x00410004;
43 43
44 std::vector<RVA> abs32_rvas; 44 std::vector<RVA> abs32_rvas;
45 abs32_rvas.push_back(kRvaA); 45 abs32_rvas.push_back(kRvaA);
46 abs32_rvas.push_back(kRvaB); 46 abs32_rvas.push_back(kRvaB);
47 std::vector<RVA> rel32_rvas; // Stub. 47 std::vector<RVA> rel32_rvas; // Stub.
48 48
49 TrivialRvaVisitor abs32_visitor(abs32_rvas); 49 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 132 EXPECT_TRUE(s5 == s6); // Adjustment did change B into A
133 } 133 }
134 134
135 TEST_F(AdjustmentMethodTest, All) { 135 TEST_F(AdjustmentMethodTest, All) {
136 Test1(); 136 Test1();
137 } 137 }
138 138
139 } // namespace 139 } // namespace
140 140
141 } // namespace courgette 141 } // namespace courgette
OLDNEW
« no previous file with comments | « no previous file | courgette/assembly_program.h » ('j') | courgette/assembly_program.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698