diff options
author | Kenny Root <kroot@google.com> | 2010-07-12 11:18:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-07-12 11:18:34 -0700 |
commit | 9baa2c7a446cde0f92320c1aeb71396b7b0f3cf5 (patch) | |
tree | 45db30090f906e068a520044e7b3bbad9c45da49 /libs/utils/tests | |
parent | 9147d11a5f1d50496908bb1f49996e3ad23e19cc (diff) | |
parent | fa59afb8631b24ebd9cca86c5a8e55f5ac8a1d36 (diff) | |
download | frameworks_native-9baa2c7a446cde0f92320c1aeb71396b7b0f3cf5.zip frameworks_native-9baa2c7a446cde0f92320c1aeb71396b7b0f3cf5.tar.gz frameworks_native-9baa2c7a446cde0f92320c1aeb71396b7b0f3cf5.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.cpp | 15 |
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"; } } |