| Index: sql/test/error_callback_support.h
|
| diff --git a/sql/test/error_callback_support.h b/sql/test/error_callback_support.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bce1495ec9d3af987ab984b0193fd847b5198334
|
| --- /dev/null
|
| +++ b/sql/test/error_callback_support.h
|
| @@ -0,0 +1,36 @@
|
| +// 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.
|
| +
|
| +#ifndef SQL_TEST_ERROR_CALLBACK_SUPPORT_H_
|
| +#define SQL_TEST_ERROR_CALLBACK_SUPPORT_H_
|
| +
|
| +#include "sql/connection.h"
|
| +
|
| +namespace sql {
|
| +
|
| +// Used in concert to test that the error callback is catching a
|
| +// specific error. For instance:
|
| +// int error = SQLITE_OK;
|
| +// ScopedErrorCallback sec(db, base::Bind(&CaptureErrorCallback, &error));
|
| +// // Provoke SQLITE_CONSTRAINT on db.
|
| +// EXPECT_EQ(SQLITE_CONSTRAINT, error);
|
| +
|
| +
|
| +void CaptureErrorCallback(int* error_pointer, int error, sql::Statement* stmt);
|
| +
|
| +class ScopedErrorCallback {
|
| + public:
|
| + ScopedErrorCallback(sql::Connection* db,
|
| + const sql::Connection::ErrorCallback& cb);
|
| + ~ScopedErrorCallback();
|
| +
|
| + private:
|
| + sql::Connection* db_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedErrorCallback);
|
| +};
|
| +
|
| +} // namespace sql
|
| +
|
| +#endif // SQL_TEST_ERROR_CALLBACK_SUPPORT_H_
|
|
|