blob: 80ccfa0f0d72a01704873b7d548faeca4eb3e768 [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) {
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