Chromium Code Reviews

Unified Diff: chrome/browser/sync/util/query_helpers_unittest.cc

Issue 340055: String cleanup in sync code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « chrome/browser/sync/util/query_helpers.cc ('k') | chrome/browser/sync/util/sync_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/query_helpers_unittest.cc
===================================================================
--- chrome/browser/sync/util/query_helpers_unittest.cc (revision 30948)
+++ chrome/browser/sync/util/query_helpers_unittest.cc (working copy)
@@ -7,7 +7,9 @@
#include <limits>
#include <string>
-#include "chrome/browser/sync/util/compat_file.h"
+#include "base/file_util.h"
+#include "chrome/common/sqlite_utils.h"
+#include "chrome/test/file_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
using std::numeric_limits;
@@ -25,12 +27,19 @@
}
TEST(QueryHelpers, TestExecFailure) {
- sqlite3* database;
- const PathString test_database(PSTR("queryhelper_test.sqlite3"));
- PathRemove(test_database);
- ASSERT_EQ(SQLITE_OK, SqliteOpen(test_database, &database));
- EXPECT_EQ(SQLITE_DONE, Exec(database, "CREATE TABLE test_table (idx int)"));
- EXPECT_NE(SQLITE_DONE, Exec(database, "ALTER TABLE test_table ADD COLUMN "
- "broken int32 default ?", -1));
- PathRemove(test_database);
+ FilePath test_database;
+ file_util::GetCurrentDirectory(&test_database);
+ test_database = test_database.Append(
+ FILE_PATH_LITERAL("queryhelper_test.sqlite3"));
+ // Cleanup left-over file, if present.
+ file_util::Delete(test_database, true);
+ FileAutoDeleter file_deleter(test_database);
+ {
+ sqlite3* database = NULL;
+ ASSERT_EQ(SQLITE_OK, SqliteOpen(test_database, &database));
+ sqlite_utils::scoped_sqlite_db_ptr database_deleter(database);
+ EXPECT_EQ(SQLITE_DONE, Exec(database, "CREATE TABLE test_table (idx int)"));
+ EXPECT_NE(SQLITE_DONE, Exec(database, "ALTER TABLE test_table ADD COLUMN "
+ "broken int32 default ?", -1));
+ }
}
« no previous file with comments | « chrome/browser/sync/util/query_helpers.cc ('k') | chrome/browser/sync/util/sync_types.h » ('j') | no next file with comments »

Powered by Google App Engine