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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "sql/connection.h" | 10 #include "sql/connection.h" |
11 #include "sql/statement.h" | 11 #include "sql/statement.h" |
12 #include "sql/test/error_callback_support.h" | 12 #include "sql/test/error_callback_support.h" |
13 #include "sql/test/scoped_error_ignorer.h" | 13 #include "sql/test/scoped_error_ignorer.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "third_party/sqlite/sqlite3.h" | 15 #include "third_party/sqlite/sqlite3.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class SQLStatementTest : public testing::Test { | 19 class SQLStatementTest : public testing::Test { |
20 public: | 20 public: |
21 virtual void SetUp() { | 21 void SetUp() override { |
22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
23 ASSERT_TRUE(db_.Open(temp_dir_.path().AppendASCII("SQLStatementTest.db"))); | 23 ASSERT_TRUE(db_.Open(temp_dir_.path().AppendASCII("SQLStatementTest.db"))); |
24 } | 24 } |
25 | 25 |
26 virtual void TearDown() { | 26 void TearDown() override { db_.Close(); } |
27 db_.Close(); | |
28 } | |
29 | 27 |
30 sql::Connection& db() { return db_; } | 28 sql::Connection& db() { return db_; } |
31 | 29 |
32 private: | 30 private: |
33 base::ScopedTempDir temp_dir_; | 31 base::ScopedTempDir temp_dir_; |
34 sql::Connection db_; | 32 sql::Connection db_; |
35 }; | 33 }; |
36 | 34 |
37 } // namespace | 35 } // namespace |
38 | 36 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 119 |
122 s.Reset(false); | 120 s.Reset(false); |
123 // Verify that we can get all rows again. | 121 // Verify that we can get all rows again. |
124 ASSERT_TRUE(s.Step()); | 122 ASSERT_TRUE(s.Step()); |
125 EXPECT_EQ(12, s.ColumnInt(0)); | 123 EXPECT_EQ(12, s.ColumnInt(0)); |
126 EXPECT_FALSE(s.Step()); | 124 EXPECT_FALSE(s.Step()); |
127 | 125 |
128 s.Reset(true); | 126 s.Reset(true); |
129 ASSERT_FALSE(s.Step()); | 127 ASSERT_FALSE(s.Step()); |
130 } | 128 } |
OLD | NEW |