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

Side by Side Diff: sql/test/error_callback_support.h

Issue 17726002: [sql] Callback and scoped-ignore tests for sql::Statement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: prevent nesting, TODO. Created 7 years, 5 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/statement_unittest.cc ('k') | sql/test/error_callback_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SQL_TEST_ERROR_CALLBACK_SUPPORT_H_
6 #define SQL_TEST_ERROR_CALLBACK_SUPPORT_H_
7
8 #include "sql/connection.h"
9
10 namespace sql {
11
12 // Helper to capture any errors into a local variable for testing.
13 // For instance:
14 // int error = SQLITE_OK;
15 // ScopedErrorCallback sec(db, base::Bind(&CaptureErrorCallback, &error));
16 // // Provoke SQLITE_CONSTRAINT on db.
17 // EXPECT_EQ(SQLITE_CONSTRAINT, error);
18 void CaptureErrorCallback(int* error_pointer, int error, sql::Statement* stmt);
19
20 // Helper to set db's error callback and then reset it when it goes
21 // out of scope.
22 class ScopedErrorCallback {
23 public:
24 ScopedErrorCallback(sql::Connection* db,
25 const sql::Connection::ErrorCallback& cb);
26 ~ScopedErrorCallback();
27
28 private:
29 sql::Connection* db_;
30
31 DISALLOW_COPY_AND_ASSIGN(ScopedErrorCallback);
32 };
33
34 } // namespace sql
35
36 #endif // SQL_TEST_ERROR_CALLBACK_SUPPORT_H_
OLDNEW
« no previous file with comments | « sql/statement_unittest.cc ('k') | sql/test/error_callback_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698