blob: 5de860e83af9aed77bd02042cff1d8cd833ed907 [file] [log] [blame]
Brian Carlstromdb4d5402011-08-09 12:18:28 -07001// 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
8namespace art {
9
10class ImageTest : public RuntimeTest {};
11
12TEST_F(ImageTest, WriteRead) {
Brian Carlstromdb4d5402011-08-09 12:18:28 -070013 scoped_ptr<DexFile> libcore_dex_file(GetLibCoreDex());
14 EXPECT_TRUE(libcore_dex_file.get() != NULL);
15
16 // TODO garbage collect before writing
17 const std::vector<Space*>& spaces = Heap::GetSpaces();
18 // can't currently deal with writing a space that might have pointers between spaces
19 CHECK_EQ(1U, spaces.size());
20
21 ImageWriter writer;
22 ScratchFile tmp;
23 bool success = writer.Write(spaces[0], tmp.GetFilename(), reinterpret_cast<byte*>(0x5000000));
24 EXPECT_TRUE(success);
25}
26
27} // namespace art