Skip to content

Commit

Permalink
Remove references to MOJO_APPTEST_IMPL in sql/
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
sgraham authored and Commit Bot committed Sep 15, 2017
1 parent 86bc62c commit 47ed2c3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 61 deletions.
12 changes: 0 additions & 12 deletions sql/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
Expand Down
19 changes: 4 additions & 15 deletions sql/connection_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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'";
Expand Down Expand Up @@ -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")));
Expand Down Expand Up @@ -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.
Expand Down
27 changes: 0 additions & 27 deletions sql/correct_sql_test_base.h

This file was deleted.

8 changes: 4 additions & 4 deletions sql/sqlite_features_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sql/statement_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions sql/transaction_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 47ed2c3

Please sign in to comment.