| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "sql/test/scoped_error_ignorer.h" | 5 #include "sql/test/scoped_error_ignorer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace sql { | 10 namespace sql { |
| 11 | 11 |
| 12 // static |
| 13 int ScopedErrorIgnorer::SQLiteLibVersionNumber() { |
| 14 return sqlite3_libversion_number(); |
| 15 } |
| 16 |
| 12 ScopedErrorIgnorer::ScopedErrorIgnorer() | 17 ScopedErrorIgnorer::ScopedErrorIgnorer() |
| 13 : checked_(false) { | 18 : checked_(false) { |
| 14 callback_ = | 19 callback_ = |
| 15 base::Bind(&ScopedErrorIgnorer::ShouldIgnore, base::Unretained(this)); | 20 base::Bind(&ScopedErrorIgnorer::ShouldIgnore, base::Unretained(this)); |
| 16 Connection::SetErrorIgnorer(&callback_); | 21 Connection::SetErrorIgnorer(&callback_); |
| 17 } | 22 } |
| 18 | 23 |
| 19 ScopedErrorIgnorer::~ScopedErrorIgnorer() { | 24 ScopedErrorIgnorer::~ScopedErrorIgnorer() { |
| 20 EXPECT_TRUE(checked_) << " Test must call CheckIgnoredErrors()"; | 25 EXPECT_TRUE(checked_) << " Test must call CheckIgnoredErrors()"; |
| 21 Connection::ResetErrorIgnorer(); | 26 Connection::ResetErrorIgnorer(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 // Unexpected error. | 56 // Unexpected error. |
| 52 ADD_FAILURE() << " Unexpected SQLite error " << err; | 57 ADD_FAILURE() << " Unexpected SQLite error " << err; |
| 53 | 58 |
| 54 // TODO(shess): If it never makes sense to pass through an error | 59 // TODO(shess): If it never makes sense to pass through an error |
| 55 // under the test harness, then perhaps the ignore callback | 60 // under the test harness, then perhaps the ignore callback |
| 56 // signature should be changed. | 61 // signature should be changed. |
| 57 return true; | 62 return true; |
| 58 } | 63 } |
| 59 | 64 |
| 60 } // namespace sql | 65 } // namespace sql |
| OLD | NEW |