| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 DeleteEncodedProgram(encoded); | 70 DeleteEncodedProgram(encoded); |
| 71 | 71 |
| 72 courgette::SinkStream sink; | 72 courgette::SinkStream sink; |
| 73 bool can_collect = sinks.CopyTo(&sink); | 73 bool can_collect = sinks.CopyTo(&sink); |
| 74 EXPECT_TRUE(can_collect); | 74 EXPECT_TRUE(can_collect); |
| 75 | 75 |
| 76 const void* buffer = sink.Buffer(); | 76 const void* buffer = sink.Buffer(); |
| 77 size_t length = sink.Length(); | 77 size_t length = sink.Length(); |
| 78 | 78 |
| 79 EXPECT_EQ(971850, length); | 79 EXPECT_EQ(971850U, length); |
| 80 | 80 |
| 81 courgette::SourceStreamSet sources; | 81 courgette::SourceStreamSet sources; |
| 82 bool can_get_source_streams = sources.Init(buffer, length); | 82 bool can_get_source_streams = sources.Init(buffer, length); |
| 83 EXPECT_TRUE(can_get_source_streams); | 83 EXPECT_TRUE(can_get_source_streams); |
| 84 | 84 |
| 85 courgette::EncodedProgram *encoded2 = NULL; | 85 courgette::EncodedProgram *encoded2 = NULL; |
| 86 const courgette::Status read_status = ReadEncodedProgram(&sources, &encoded2); | 86 const courgette::Status read_status = ReadEncodedProgram(&sources, &encoded2); |
| 87 EXPECT_EQ(courgette::C_OK, read_status); | 87 EXPECT_EQ(courgette::C_OK, read_status); |
| 88 | 88 |
| 89 courgette::SinkStream assembled; | 89 courgette::SinkStream assembled; |
| 90 const courgette::Status assemble_status = Assemble(encoded2, &assembled); | 90 const courgette::Status assemble_status = Assemble(encoded2, &assembled); |
| 91 EXPECT_EQ(courgette::C_OK, assemble_status); | 91 EXPECT_EQ(courgette::C_OK, assemble_status); |
| 92 | 92 |
| 93 const void* assembled_buffer = assembled.Buffer(); | 93 const void* assembled_buffer = assembled.Buffer(); |
| 94 size_t assembled_length = assembled.Length(); | 94 size_t assembled_length = assembled.Length(); |
| 95 | 95 |
| 96 EXPECT_EQ(original_length, assembled_length); | 96 EXPECT_EQ(original_length, assembled_length); |
| 97 EXPECT_EQ(0, memcmp(original_buffer, assembled_buffer, original_length)); | 97 EXPECT_EQ(0, memcmp(original_buffer, assembled_buffer, original_length)); |
| 98 | 98 |
| 99 DeleteEncodedProgram(encoded2); | 99 DeleteEncodedProgram(encoded2); |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 TEST_F(EncodeDecodeTest, All) { | 103 TEST_F(EncodeDecodeTest, All) { |
| 104 TestExe("setup1.exe"); | 104 TestExe("setup1.exe"); |
| 105 } | 105 } |
| OLD | NEW |