Brian Carlstrom | db4d540 | 2011-08-09 12:18:28 -0700 | [diff] [blame^] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #include "common_test.h" |
| 4 | #include "image_writer.h" |
| 5 | |
| 6 | #include "gtest/gtest.h" |
| 7 | |
| 8 | namespace art { |
| 9 | |
| 10 | class ImageTest : public RuntimeTest {}; |
| 11 | |
| 12 | TEST_F(ImageTest, WriteRead) { |
| 13 | UseLibCoreDex(); |
| 14 | scoped_ptr<DexFile> libcore_dex_file(GetLibCoreDex()); |
| 15 | EXPECT_TRUE(libcore_dex_file.get() != NULL); |
| 16 | |
| 17 | // TODO garbage collect before writing |
| 18 | const std::vector<Space*>& spaces = Heap::GetSpaces(); |
| 19 | // can't currently deal with writing a space that might have pointers between spaces |
| 20 | CHECK_EQ(1U, spaces.size()); |
| 21 | |
| 22 | ImageWriter writer; |
| 23 | ScratchFile tmp; |
| 24 | bool success = writer.Write(spaces[0], tmp.GetFilename(), reinterpret_cast<byte*>(0x5000000)); |
| 25 | EXPECT_TRUE(success); |
| 26 | } |
| 27 | |
| 28 | } // namespace art |