Switch to UniquePtr.
Only one use of scoped_ptr was incorrect (but then again, I spent an afternoon
with valgrind finding and fixing them just last week).
Change-Id: If5ec1c8aa0794a4f652bfd1c0fffccf95facdc40
diff --git a/src/file_test.cc b/src/file_test.cc
index 385b3dd..0019c1d 100644
--- a/src/file_test.cc
+++ b/src/file_test.cc
@@ -1,11 +1,11 @@
// Copyright 2009 Google Inc. All Rights Reserved.
-#include "common_test.h"
#include "file.h"
-#include "os.h"
-#include "scoped_ptr.h"
+#include "UniquePtr.h"
+#include "common_test.h"
#include "gtest/gtest.h"
+#include "os.h"
namespace art {
@@ -13,8 +13,8 @@
TEST_F(FileTest, Read) {
std::string filename = GetLibCoreDexFileName();
- scoped_ptr<File> file(OS::OpenFile(filename.c_str(), false));
- ASSERT_TRUE(file != NULL);
+ UniquePtr<File> file(OS::OpenFile(filename.c_str(), false));
+ ASSERT_TRUE(file.get() != NULL);
EXPECT_STREQ(filename.c_str(), file->name());
char buffer[3];
buffer[0] = '\0';
@@ -27,16 +27,16 @@
TEST_F(FileTest, FileLength) {
std::string filename = GetLibCoreDexFileName();
- scoped_ptr<File> file(OS::OpenFile(filename.c_str(), false));
- ASSERT_TRUE(file != NULL);
+ UniquePtr<File> file(OS::OpenFile(filename.c_str(), false));
+ ASSERT_TRUE(file.get() != NULL);
EXPECT_NE(0, file->Length());
}
TEST_F(FileTest, FilePosition) {
std::string filename = GetLibCoreDexFileName();
- scoped_ptr<File> file(OS::OpenFile(filename.c_str(), false));
- ASSERT_TRUE(file != NULL);
+ UniquePtr<File> file(OS::OpenFile(filename.c_str(), false));
+ ASSERT_TRUE(file.get() != NULL);
char buf[4];
EXPECT_TRUE(file->ReadFully(buf, 2));
EXPECT_EQ(2, file->Position());
@@ -47,8 +47,8 @@
TEST_F(FileTest, FileFd) {
std::string filename = GetLibCoreDexFileName();
- scoped_ptr<File> file(OS::OpenFile(filename.c_str(), false));
- ASSERT_TRUE(file != NULL);
+ UniquePtr<File> file(OS::OpenFile(filename.c_str(), false));
+ ASSERT_TRUE(file.get() != NULL);
EXPECT_NE(-1, file->Fd());
}