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

Unified Diff: sql/test/error_callback_support.cc

Issue 17726002: [sql] Callback and scoped-ignore tests for sql::Statement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« sql/statement_unittest.cc ('K') | « sql/test/error_callback_support.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/test/error_callback_support.cc
diff --git a/sql/test/error_callback_support.cc b/sql/test/error_callback_support.cc
new file mode 100644
index 0000000000000000000000000000000000000000..724c7a433098365274e4c472a97be8eb700c9822
--- /dev/null
+++ b/sql/test/error_callback_support.cc
@@ -0,0 +1,24 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sql/test/error_callback_support.h"
+
+namespace sql {
+
+void CaptureErrorCallback(int* error_pointer, int error, sql::Statement* stmt) {
+ *error_pointer = error;
+}
+
+ScopedErrorCallback::ScopedErrorCallback(
+ sql::Connection* db,
+ const sql::Connection::ErrorCallback& cb)
+ : db_(db) {
Greg Billock 2013/06/27 20:27:26 Any need to check if one has already been set? Per
Scott Hess - ex-Googler 2013/06/27 20:59:45 Yeah, probably. I'm inclined towards a DCHECK for
Scott Hess - ex-Googler 2013/06/28 22:04:37 A DCHECK would result in moving set_error_callback
+ db_->set_error_callback(cb);
+}
+
+ScopedErrorCallback::~ScopedErrorCallback() {
+ db_->reset_error_callback();
+}
+
+} // namespace
« sql/statement_unittest.cc ('K') | « sql/test/error_callback_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698