diff options
author | yongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 08:25:53 +0000 |
---|---|---|
committer | yongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 08:25:53 +0000 |
commit | 1348765a72f3c22d4cae052bd774184cc8403250 (patch) | |
tree | 6a6ce644bccfac6b56c0a277076c5960dbcb571f /sql/connection_unittest.cc | |
parent | 5d2172c0f59e14907d5ab2687fa59a23726c59dc (diff) | |
download | chromium_src-1348765a72f3c22d4cae052bd774184cc8403250.zip chromium_src-1348765a72f3c22d4cae052bd774184cc8403250.tar.gz chromium_src-1348765a72f3c22d4cae052bd774184cc8403250.tar.bz2 |
Fix the sqlite errors of content unittests on Android
Many tests are failed due to sqlite errors on Android.
The reason is that sqlite need a temporary directory to
store internal temporary files. However, Android doesn't
have this kind of directory while Linux has /var/tmp.
To fix this, use in-memory temporary files. It also includes:
1) Add one unit test in sql unittests to reproduce this
issue for Android.
2) Remove those disabled cases for content unitests on
Android.
BUG=
TEST=run_tests.py -s sql_unittests; run_test.py -s net_unittests
Review URL: https://chromiumcodereview.appspot.com/10809015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql/connection_unittest.cc')
-rw-r--r-- | sql/connection_unittest.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc index 773de5b..565c12f 100644 --- a/sql/connection_unittest.cc +++ b/sql/connection_unittest.cc @@ -6,6 +6,7 @@ #include "base/scoped_temp_dir.h" #include "sql/connection.h" #include "sql/statement.h" +#include "sql/meta_table.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/sqlite/sqlite3.h" @@ -259,6 +260,19 @@ TEST_F(SQLConnectionTest, RazeLocked) { ASSERT_TRUE(db().Raze()); } +#if defined(OS_ANDROID) +TEST_F(SQLConnectionTest, SetTempDirForSQL) { + + sql::MetaTable meta_table; + // Below call needs a temporary directory in sqlite3 + // On Android, it can pass only when the temporary directory is set. + // Otherwise, sqlite3 doesn't find the correct directory to store + // temporary files and will report the error 'unable to open + // database file'. + ASSERT_TRUE(meta_table.Init(&db(), 4, 4)); +} +#endif + // TODO(shess): Spin up a background thread to hold other_db, to more // closely match real life. That would also allow testing // RazeWithTimeout(). |