summaryrefslogtreecommitdiffstats
path: root/sql/correct_sql_test_base.h
diff options
context:
space:
mode:
authorerg <erg@chromium.org>2015-06-19 18:38:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-20 01:38:55 +0000
commit102ceb4133685db70ac15cb5bcb134a85736fe86 (patch)
treeb902e100529fe3675e293c49c70eed32c430daf7 /sql/correct_sql_test_base.h
parent55002d65c4a31e6b386cbe9dc02dfaa24d3fb42d (diff)
downloadchromium_src-102ceb4133685db70ac15cb5bcb134a85736fe86.zip
chromium_src-102ceb4133685db70ac15cb5bcb134a85736fe86.tar.gz
chromium_src-102ceb4133685db70ac15cb5bcb134a85736fe86.tar.bz2
mandoline filesystem: add a sqlite3 vfs to proxy filesystem usage.
This adds a //sql/mojo library which can be linked into preexisting sqlite3 code which adds a new VFS which transparently proxies filesystem usage to the mojo:filesystem application. We create a new sql_apptests.mojo target, which currently has all the sql connection_unittests.cc (minus 2 hard ones), all statement and transaction unit tests and refactor the sql testing stuff so that we have two implementations of an SQLTestBase class: one that uses files raw and one that proxies to the filesystem process. Notably, this patch does not implement file locking, which will have to be implemented before we can safely use this, but will be a large enough patch in and of itself that I'm punting on it for this patch. BUG=493311 Review URL: https://codereview.chromium.org/1176653002 Cr-Commit-Position: refs/heads/master@{#335415}
Diffstat (limited to 'sql/correct_sql_test_base.h')
-rw-r--r--sql/correct_sql_test_base.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/sql/correct_sql_test_base.h b/sql/correct_sql_test_base.h
new file mode 100644
index 0000000..7056dea
--- /dev/null
+++ b/sql/correct_sql_test_base.h
@@ -0,0 +1,27 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SQL_CORRECT_SQL_TEST_BASE_H_
+#define SQL_CORRECT_SQL_TEST_BASE_H_
+
+// This header exists to get around gn check. We want to use the same testing
+// code in both the sql_unittests target (which uses gtest and targets the
+// filesystem directly) and sql_apptests.mojo (which uses mojo:apptest and
+// proxies the additional filesystem access to mojo:filesystem). Both of these
+// files define a class named sql::SQLTestBase and have the same interface.
+//
+// Unfortunately, gn check does not understand preprocessor directives. If it
+// did, the following code would be gn check clean, but since it isn't, we
+// stuff this redirection header in its own file, give it its own source_set
+// target, and then set check_includes to false.
+//
+// This work around was suggested by brettw@.
+#if defined(MOJO_APPTEST_IMPL)
+#include "sql/mojo/sql_test_base.h"
+#else
+#include "sql/test/sql_test_base.h"
+#endif
+
+#endif // SQL_CORRECT_SQL_TEST_BASE_H_
+