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

Unified Diff: chrome/browser/history/android/android_cache_database_unittest.cc

Issue 9549031: The implementation of AndroidCacheDatabase. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync and remove the Created 8 years, 10 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
« no previous file with comments | « chrome/browser/history/android/android_cache_database.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/android/android_cache_database_unittest.cc
diff --git a/chrome/browser/history/android/android_cache_database_unittest.cc b/chrome/browser/history/android/android_cache_database_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..72567854c36f94005e9c41fdde5be6ccbd86c242
--- /dev/null
+++ b/chrome/browser/history/android/android_cache_database_unittest.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2012 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 "base/file_path.h"
+#include "base/file_util.h"
+#include "base/scoped_temp_dir.h"
+#include "chrome/browser/history/android/android_cache_database.h"
+#include "chrome/browser/history/history_database.h"
+#include "chrome/test/base/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace history {
+
+class SimpleAndroidCacheDatabase : public AndroidCacheDatabase {
+ public:
+ explicit SimpleAndroidCacheDatabase(sql::Connection* connection)
+ :db_(connection) {
+ }
+
+ protected:
+ sql::Connection& GetDB() {
+ return *db_;
+ }
+
+ private:
+ sql::Connection* db_;
+};
+
+class AndroidCacheDatabaseTest : public testing::Test {
+ public:
+ AndroidCacheDatabaseTest() {
+ }
+ ~AndroidCacheDatabaseTest() {
+ }
+
+ protected:
+ virtual void SetUp() {
+ // Get a temporary directory for the test DB files.
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ main_db_name_ = temp_dir_.path().AppendASCII("history.db");
+ android_cache_db_name_ = temp_dir_.path().AppendASCII(
+ "TestAndroidCache.db");
+ }
+
+ ScopedTempDir temp_dir_;
+ FilePath android_cache_db_name_;
+ FilePath main_db_name_;
+};
+
+TEST_F(AndroidCacheDatabaseTest, InitAndroidCacheDatabase) {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(main_db_name_));
+ SimpleAndroidCacheDatabase android_cache_db(&connection);
+ EXPECT_EQ(sql::INIT_OK,
+ android_cache_db.InitAndroidCacheDatabase(android_cache_db_name_));
+ // Try to run a sql against the table to verify it exists.
+ EXPECT_TRUE(connection.Execute(
+ "DELETE FROM android_cache_db.bookmark_cache"));
+}
+
+} // namespace history
« no previous file with comments | « chrome/browser/history/android/android_cache_database.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698