0

Remove references to MOJO_APPTEST_IMPL in sql/

Noticed while porting sql_unittests to Fuchsia. Seems to be dead code.

Bug: 764423
Change-Id: Ibe238f3674a3b7fbcf9dfd4e98d23052f6161e12
Reviewed-on: https://chromium-review.googlesource.com/665349
Reviewed-by: Elliot Glaysher <erg@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502134}
This commit is contained in:
Scott Graham
2017-09-15 02:17:07 +00:00
committed by Commit Bot
parent 86bc62c9de
commit 47ed2c3f20
6 changed files with 11 additions and 61 deletions

@ -69,17 +69,6 @@ static_library("test_support") {
]
}
source_set("redirection_header") {
# This target exists because we need a way to switch between
# "test/sql_test_base.h" and "mojo/sql_test_base.h" at compile time, to allow
# us to switch out the gtest vs mojo:apptest frameworks.
check_includes = false
sources = [
"correct_sql_test_base.h",
]
}
bundle_data("sql_unittests_bundle_data") {
testonly = true
sources = [
@ -117,7 +106,6 @@ test("sql_unittests") {
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
deps = [
":redirection_header",
":sql",
":sql_unittests_bundle_data",
":test_support",

@ -17,11 +17,11 @@
#include "build/build_config.h"
#include "sql/connection.h"
#include "sql/connection_memory_dump_provider.h"
#include "sql/correct_sql_test_base.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
#include "sql/test/error_callback_support.h"
#include "sql/test/scoped_error_expecter.h"
#include "sql/test/sql_test_base.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"
@ -607,8 +607,6 @@ TEST_F(SQLConnectionTest, RazeMultiple) {
ASSERT_EQ(0, SqliteMasterCount(&other_db));
}
// TODO(erg): Enable this in the next patch once I add locking.
#if !defined(MOJO_APPTEST_IMPL)
TEST_F(SQLConnectionTest, RazeLocked) {
const char* kCreateSql = "CREATE TABLE foo (id INTEGER PRIMARY KEY, value)";
ASSERT_TRUE(db().Execute(kCreateSql));
@ -643,7 +641,6 @@ TEST_F(SQLConnectionTest, RazeLocked) {
ASSERT_FALSE(s.Step());
ASSERT_TRUE(db().Raze());
}
#endif
// Verify that Raze() can handle an empty file. SQLite should treat
// this as an empty database.
@ -919,9 +916,8 @@ TEST_F(SQLConnectionTest, Delete) {
EXPECT_FALSE(GetPathExists(journal));
}
// This test manually sets on disk permissions; this doesn't apply to the mojo
// fork or Fuchsia.
#if defined(OS_POSIX) && !defined(MOJO_APPTEST_IMPL) && !defined(OS_FUCHSIA)
// This test manually sets on disk permissions, these don't exist on Fuchsia.
#if defined(OS_POSIX) && !defined(OS_FUCHSIA)
// Test that set_restrict_to_user() trims database permissions so that
// only the owner (and root) can read.
TEST_F(SQLConnectionTest, UserPermission) {
@ -985,8 +981,7 @@ TEST_F(SQLConnectionTest, UserPermission) {
EXPECT_TRUE(base::GetPosixFilePermissions(journal, &mode));
ASSERT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode);
}
#endif // defined(OS_POSIX) && !defined(MOJO_APPTEST_IMPL) &&
// !defined(OS_FUCHSIA)
#endif // defined(OS_POSIX) && !defined(OS_FUCHSIA)
// Test that errors start happening once Poison() is called.
TEST_F(SQLConnectionTest, Poison) {
@ -1423,13 +1418,9 @@ TEST_F(SQLConnectionTest, OnMemoryDump) {
// Test that the functions to collect diagnostic data run to completion, without
// worrying too much about what they generate (since that will change).
TEST_F(SQLConnectionTest, CollectDiagnosticInfo) {
// NOTE(shess): Mojo doesn't support everything CollectCorruptionInfo() uses,
// but it's not really clear if adding support would be useful.
#if !defined(MOJO_APPTEST_IMPL)
const std::string corruption_info = db().CollectCorruptionInfo();
EXPECT_NE(std::string::npos, corruption_info.find("SQLITE_CORRUPT"));
EXPECT_NE(std::string::npos, corruption_info.find("integrity_check"));
#endif
// A statement to see in the results.
const char* kSimpleSql = "SELECT 'mountain'";
@ -1457,7 +1448,6 @@ TEST_F(SQLConnectionTest, CollectDiagnosticInfo) {
EXPECT_NE(std::string::npos, error_info.find("version: 4"));
}
#if !defined(MOJO_APPTEST_IMPL)
TEST_F(SQLConnectionTest, RegisterIntentToUpload) {
base::FilePath breadcrumb_path(
db_path().DirName().Append(FILE_PATH_LITERAL("sqlite-diag")));
@ -1491,7 +1481,6 @@ TEST_F(SQLConnectionTest, RegisterIntentToUpload) {
ASSERT_TRUE(db().Open(db_path()));
EXPECT_FALSE(db().RegisterIntentToUpload());
}
#endif // !defined(MOJO_APPTEST_IMPL)
// Test that a fresh database has mmap enabled by default, if mmap'ed I/O is
// enabled by SQLite.

@ -1,27 +0,0 @@
// 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_

@ -164,7 +164,7 @@ TEST_F(SQLiteFeaturesTest, ForeignKeySupport) {
EXPECT_EQ("", ExecuteWithResult(&db(), kSelectChildren));
}
#if defined(MOJO_APPTEST_IMPL) || defined(OS_IOS) || defined(OS_FUCHSIA)
#if defined(OS_IOS) || defined(OS_FUCHSIA)
// If the platform cannot support SQLite mmap'ed I/O, make sure SQLite isn't
// offering to support it.
TEST_F(SQLiteFeaturesTest, NoMmap) {
@ -190,9 +190,9 @@ TEST_F(SQLiteFeaturesTest, NoMmap) {
sql::Statement s(db().GetUniqueStatement("PRAGMA mmap_size"));
ASSERT_TRUE(!s.Step() || !s.ColumnInt64(0));
}
#endif
#endif // defined(OS_IOS) || defined(OS_FUCHSIA)
#if !defined(MOJO_APPTEST_IMPL) && !defined(OS_FUCHSIA)
#if !defined(OS_FUCHSIA)
// 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
@ -281,7 +281,7 @@ TEST_F(SQLiteFeaturesTest, Mmap) {
ASSERT_EQ('4', m.data()[kOffset]);
}
}
#endif
#endif // !defined(OS_FUCHSIA)
// Verify that http://crbug.com/248608 is fixed. In this bug, the
// compiled regular expression is effectively cached with the prepared

@ -8,10 +8,10 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "sql/connection.h"
#include "sql/correct_sql_test_base.h"
#include "sql/statement.h"
#include "sql/test/error_callback_support.h"
#include "sql/test/scoped_error_expecter.h"
#include "sql/test/sql_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"

@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sql/transaction.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "sql/connection.h"
#include "sql/correct_sql_test_base.h"
#include "sql/statement.h"
#include "sql/transaction.h"
#include "sql/test/sql_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"