Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: sql/sqlite_features_unittest.cc

Issue 2083543003: Updates SQL code now that mmap is supported on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sql/connection_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/sqlite_features_unittest.cc
diff --git a/sql/sqlite_features_unittest.cc b/sql/sqlite_features_unittest.cc
index 9b8c97166455da1928819ffe367542a71bbb0a9e..b84a80d69c0d597ba1c38d7ca6dc666473a23c01 100644
--- a/sql/sqlite_features_unittest.cc
+++ b/sql/sqlite_features_unittest.cc
@@ -18,6 +18,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"
+#if defined(OS_IOS)
+#include "base/ios/ios_util.h"
+#endif
+
// Test that certain features are/are-not enabled in our SQLite.
namespace {
@@ -151,6 +155,13 @@ TEST_F(SQLiteFeaturesTest, ForeignKeySupport) {
// If the platform cannot support SQLite mmap'ed I/O, make sure SQLite isn't
// offering to support it.
TEST_F(SQLiteFeaturesTest, NoMmap) {
+#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
+ if (base::ios::IsRunningOnIOS10OrLater()) {
+ // iOS 10 added mmap support for sqlite.
+ return;
+ }
+#endif
+
// For recent versions of SQLite, SQLITE_MAX_MMAP_SIZE=0 can be used to
// disable mmap support. Alternately, sqlite3_config() could be used. In
// that case, the pragma will run successfully, but the size will always be 0.
@@ -166,7 +177,9 @@ TEST_F(SQLiteFeaturesTest, NoMmap) {
sql::Statement s(db().GetUniqueStatement("PRAGMA mmap_size"));
ASSERT_TRUE(!s.Step() || !s.ColumnInt64(0));
}
-#else
+#endif
+
+#if !defined(MOJO_APPTEST_IMPL)
// Verify that OS file writes are reflected in the memory mapping of a
// memory-mapped file. Normally SQLite writes to memory-mapped files using
// memcpy(), which should stay consistent. Our SQLite is slightly patched to
@@ -174,6 +187,13 @@ TEST_F(SQLiteFeaturesTest, NoMmap) {
// version doesn't reflect the OS file writes, SQLite's memory-mapped I/O should
// be disabled on this platform using SQLITE_MAX_MMAP_SIZE=0.
TEST_F(SQLiteFeaturesTest, Mmap) {
+#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
+ if (!base::ios::IsRunningOnIOS10OrLater()) {
+ // iOS9's sqlite does not support mmap, so this test must be skipped.
+ return;
+ }
+#endif
+
// Try to turn on mmap'ed I/O.
ignore_result(db().Execute("PRAGMA mmap_size = 1048576"));
{
« no previous file with comments | « sql/connection_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698