summaryrefslogtreecommitdiffstats
path: root/libs/utils/tests
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-07-12 11:18:34 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-07-12 11:18:34 -0700
commit87bb18579a5eea2e24af78af8c0f54f5455ce8fd (patch)
tree4538368088979c951572d317c7b9af696194c25a /libs/utils/tests
parentfaccac7616795859af257777900db514d425a106 (diff)
parent87315aa1f0b64efcef416628215be89851cc4736 (diff)
downloadframeworks_base-87bb18579a5eea2e24af78af8c0f54f5455ce8fd.zip
frameworks_base-87bb18579a5eea2e24af78af8c0f54f5455ce8fd.tar.gz
frameworks_base-87bb18579a5eea2e24af78af8c0f54f5455ce8fd.tar.bz2
Merge changes I2337051b,I19b426cb into gingerbread
* changes: Tweak ObbFile class Allow things that can install packages to set Obb paths
Diffstat (limited to 'libs/utils/tests')
-rw-r--r--libs/utils/tests/ObbFile_test.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/libs/utils/tests/ObbFile_test.cpp b/libs/utils/tests/ObbFile_test.cpp
index 05aaf08..29bb70a 100644
--- a/libs/utils/tests/ObbFile_test.cpp
+++ b/libs/utils/tests/ObbFile_test.cpp
@@ -22,6 +22,8 @@
#include <gtest/gtest.h>
+#include <fcntl.h>
+
namespace android {
#define TEST_FILENAME "/test.obb"
@@ -39,6 +41,11 @@ protected:
const int totalLen = strlen(mExternalStorage) + strlen(TEST_FILENAME) + 1;
mFileName = new char[totalLen];
snprintf(mFileName, totalLen, "%s%s", mExternalStorage, TEST_FILENAME);
+
+ int fd = ::open(mFileName, O_CREAT | O_TRUNC);
+ if (fd < 0) {
+ FAIL() << "Couldn't create " << mFileName << " for tests";
+ }
}
virtual void TearDown() {
@@ -46,8 +53,8 @@ protected:
};
TEST_F(ObbFileTest, ReadFailure) {
- EXPECT_FALSE(mObbFile->readFrom(-1))
- << "No failure on invalid file descriptor";
+ EXPECT_FALSE(mObbFile->readFrom(-1))
+ << "No failure on invalid file descriptor";
}
TEST_F(ObbFileTest, WriteThenRead) {
@@ -66,10 +73,10 @@ TEST_F(ObbFileTest, WriteThenRead) {
<< "couldn't read from fake .obb file";
EXPECT_EQ(versionNum, mObbFile->getVersion())
- << "version didn't come out the same as it went in";
+ << "version didn't come out the same as it went in";
const char* currentPackageName = mObbFile->getPackageName().string();
EXPECT_STREQ(packageName, currentPackageName)
- << "package name didn't come out the same as it went in";
+ << "package name didn't come out the same as it went in";
}
}