Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(938)

Side by Side Diff: sql/statement_unittest.cc

Issue 12211033: Linux/ChromeOS Chromium style checker cleanup, sql/ edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/sqlite_features_unittest.cc ('k') | sql/transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/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"
(...skipping 22 matching lines...) Expand all
33 int* error_; 33 int* error_;
34 std::string* sql_text_; 34 std::string* sql_text_;
35 35
36 DISALLOW_COPY_AND_ASSIGN(StatementErrorHandler); 36 DISALLOW_COPY_AND_ASSIGN(StatementErrorHandler);
37 }; 37 };
38 38
39 class SQLStatementTest : public testing::Test { 39 class SQLStatementTest : public testing::Test {
40 public: 40 public:
41 SQLStatementTest() : error_(SQLITE_OK) {} 41 SQLStatementTest() : error_(SQLITE_OK) {}
42 42
43 void SetUp() { 43 virtual void SetUp() {
44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
45 ASSERT_TRUE(db_.Open(temp_dir_.path().AppendASCII("SQLStatementTest.db"))); 45 ASSERT_TRUE(db_.Open(temp_dir_.path().AppendASCII("SQLStatementTest.db")));
46 // The error delegate will set |error_| and |sql_text_| when any sqlite 46 // The error delegate will set |error_| and |sql_text_| when any sqlite
47 // statement operation returns an error code. 47 // statement operation returns an error code.
48 db_.set_error_delegate(new StatementErrorHandler(&error_, &sql_text_)); 48 db_.set_error_delegate(new StatementErrorHandler(&error_, &sql_text_));
49 } 49 }
50 50
51 void TearDown() { 51 virtual void TearDown() {
52 // If any error happened the original sql statement can be found in 52 // If any error happened the original sql statement can be found in
53 // |sql_text_|. 53 // |sql_text_|.
54 EXPECT_EQ(SQLITE_OK, error_); 54 EXPECT_EQ(SQLITE_OK, error_);
55 db_.Close(); 55 db_.Close();
56 } 56 }
57 57
58 sql::Connection& db() { return db_; } 58 sql::Connection& db() { return db_; }
59 59
60 int sqlite_error() const { return error_; } 60 int sqlite_error() const { return error_; }
61 61
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 s.Reset(false); 144 s.Reset(false);
145 // Verify that we can get all rows again. 145 // Verify that we can get all rows again.
146 ASSERT_TRUE(s.Step()); 146 ASSERT_TRUE(s.Step());
147 EXPECT_EQ(12, s.ColumnInt(0)); 147 EXPECT_EQ(12, s.ColumnInt(0));
148 EXPECT_FALSE(s.Step()); 148 EXPECT_FALSE(s.Step());
149 149
150 s.Reset(true); 150 s.Reset(true);
151 ASSERT_FALSE(s.Step()); 151 ASSERT_FALSE(s.Step());
152 } 152 }
OLDNEW
« no previous file with comments | « sql/sqlite_features_unittest.cc ('k') | sql/transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698