| 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/courgette.h" | 6 #include "courgette/courgette.h" |
| 7 #include "courgette/streams.h" | 7 #include "courgette/streams.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) && !defined(NDEBUG) | 9 #if defined(OS_WIN) && !defined(NDEBUG) |
| 10 // Ensemble tests still take too long on Debug Windows so disabling for now | 10 // Ensemble tests still take too long on Debug Windows so disabling for now |
| 11 // TODO(dgarrett) http://code.google.com/p/chromium/issues/detail?id=101614 | 11 // TODO(dgarrett) http://code.google.com/p/chromium/issues/detail?id=101614 |
| 12 #define MAYBE_PE DISABLED_PE | 12 #define MAYBE_PE DISABLED_PE |
| 13 #define MAYBE_PE64 DISABLED_PE64 | 13 #define MAYBE_PE64 DISABLED_PE64 |
| 14 #define MAYBE_Elf32 DISABLED_Elf32 | 14 #define MAYBE_Elf32 DISABLED_Elf32 |
| 15 #else | 15 #else |
| 16 #define MAYBE_PE PE | 16 #define MAYBE_PE PE |
| 17 #define MAYBE_PE64 PE64 | 17 #define MAYBE_PE64 PE64 |
| 18 #define MAYBE_Elf32 Elf32 | 18 #define MAYBE_Elf32 Elf32 |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 class EnsembleTest : public BaseTest { | 21 class EnsembleTest : public BaseTest { |
| 22 public: | 22 public: |
| 23 | 23 void TestEnsemble(const std::string& src_bytes, |
| 24 void TestEnsemble(std::string src_bytes, std::string tgt_bytes) const; | 24 const std::string& tgt_bytes) const; |
| 25 | 25 |
| 26 void PeEnsemble() const; | 26 void PeEnsemble() const; |
| 27 void Pe64Ensemble() const; | 27 void Pe64Ensemble() const; |
| 28 void Elf32Ensemble() const; | 28 void Elf32Ensemble() const; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 void EnsembleTest::TestEnsemble(std::string src_bytes, | 31 void EnsembleTest::TestEnsemble(const std::string& src_bytes, |
| 32 std::string tgt_bytes) const { | 32 const std::string& tgt_bytes) const { |
| 33 | |
| 34 courgette::SourceStream source; | 33 courgette::SourceStream source; |
| 35 courgette::SourceStream target; | 34 courgette::SourceStream target; |
| 36 | 35 |
| 37 source.Init(src_bytes); | 36 source.Init(src_bytes); |
| 38 target.Init(tgt_bytes); | 37 target.Init(tgt_bytes); |
| 39 | 38 |
| 40 courgette::SinkStream patch_sink; | 39 courgette::SinkStream patch_sink; |
| 41 | 40 |
| 42 courgette::Status status; | 41 courgette::Status status; |
| 43 | 42 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 PeEnsemble(); | 118 PeEnsemble(); |
| 120 } | 119 } |
| 121 | 120 |
| 122 TEST_F(EnsembleTest, MAYBE_PE64) { | 121 TEST_F(EnsembleTest, MAYBE_PE64) { |
| 123 Pe64Ensemble(); | 122 Pe64Ensemble(); |
| 124 } | 123 } |
| 125 | 124 |
| 126 TEST_F(EnsembleTest, MAYBE_Elf32) { | 125 TEST_F(EnsembleTest, MAYBE_Elf32) { |
| 127 Elf32Ensemble(); | 126 Elf32Ensemble(); |
| 128 } | 127 } |
| OLD | NEW |