OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "sql/connection.h" | 9 #include "sql/connection.h" |
10 #include "sql/statement.h" | 10 #include "sql/statement.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/sqlite/sqlite3.h" | 12 #include "third_party/sqlite/sqlite3.h" |
13 | 13 |
14 // Test that certain features are/are-not enabled in our SQLite. | 14 // Test that certain features are/are-not enabled in our SQLite. |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class StatementErrorHandler : public sql::ErrorDelegate { | 18 class StatementErrorHandler : public sql::ErrorDelegate { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 db_.Close(); | 58 db_.Close(); |
59 } | 59 } |
60 | 60 |
61 sql::Connection& db() { return db_; } | 61 sql::Connection& db() { return db_; } |
62 | 62 |
63 int sqlite_error() const { | 63 int sqlite_error() const { |
64 return error_; | 64 return error_; |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 ScopedTempDir temp_dir_; | 68 base::ScopedTempDir temp_dir_; |
69 sql::Connection db_; | 69 sql::Connection db_; |
70 | 70 |
71 // The error code of the most recent error. | 71 // The error code of the most recent error. |
72 int error_; | 72 int error_; |
73 // Original statement which has caused the error. | 73 // Original statement which has caused the error. |
74 std::string sql_text_; | 74 std::string sql_text_; |
75 }; | 75 }; |
76 | 76 |
77 // Do not include fts1 support, it is not useful, and nobody is | 77 // Do not include fts1 support, it is not useful, and nobody is |
78 // looking at it. | 78 // looking at it. |
(...skipping 12 matching lines...) Expand all Loading... |
91 ASSERT_TRUE(db().Execute("CREATE VIRTUAL TABLE foo USING fts2(x)")); | 91 ASSERT_TRUE(db().Execute("CREATE VIRTUAL TABLE foo USING fts2(x)")); |
92 } | 92 } |
93 #endif | 93 #endif |
94 | 94 |
95 // fts3 is used for current history files, and also for WebDatabase. | 95 // fts3 is used for current history files, and also for WebDatabase. |
96 TEST_F(SQLiteFeaturesTest, FTS3) { | 96 TEST_F(SQLiteFeaturesTest, FTS3) { |
97 ASSERT_TRUE(db().Execute("CREATE VIRTUAL TABLE foo USING fts3(x)")); | 97 ASSERT_TRUE(db().Execute("CREATE VIRTUAL TABLE foo USING fts3(x)")); |
98 } | 98 } |
99 | 99 |
100 } // namespace | 100 } // namespace |
OLD | NEW |