diff options
author | yuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 04:27:53 +0000 |
---|---|---|
committer | yuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 04:27:53 +0000 |
commit | 25a5dcb7ce35ca15a9e4db1c13e8ec0db3b387b4 (patch) | |
tree | 5bc68d43f3a1cfb468c9c51b55ce56ab78a2ce34 /chrome/browser/meta_table_helper_unittest.cc | |
parent | fc2eedbe7f2895cca80d8eb2d8364551ec49f925 (diff) | |
download | chromium_src-25a5dcb7ce35ca15a9e4db1c13e8ec0db3b387b4.zip chromium_src-25a5dcb7ce35ca15a9e4db1c13e8ec0db3b387b4.tar.gz chromium_src-25a5dcb7ce35ca15a9e4db1c13e8ec0db3b387b4.tar.bz2 |
Refactor MetaTableHelper to remove redundant table name prefixing with database
name. Also, PrimeCache logic duplicated in HistoryBackend and
SQLitePersistentCookieStore is moved to this class.
BUG=none
TEST=n/a
Review URL: http://codereview.chromium.org/150094
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/meta_table_helper_unittest.cc')
-rw-r--r-- | chrome/browser/meta_table_helper_unittest.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/meta_table_helper_unittest.cc b/chrome/browser/meta_table_helper_unittest.cc new file mode 100644 index 0000000..0d8ae5b --- /dev/null +++ b/chrome/browser/meta_table_helper_unittest.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2009 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. + +// Tests for MetaTableHelper. + +#include "chrome/browser/meta_table_helper.h" +#include "testing/gtest/include/gtest/gtest.h" + +class MetaTableHelperTest : public testing::Test { + public: + static void appendMetaTableName(const std::string& db_name, + std::string* sql) { + MetaTableHelper::appendMetaTableName(db_name, sql); + } +}; + +TEST_F(MetaTableHelperTest, EmptyDbName) { + std::string sql("select * from "); + MetaTableHelperTest::appendMetaTableName(std::string(), &sql); + EXPECT_EQ("select * from meta", sql); +} + +TEST_F(MetaTableHelperTest, NonEmptyDbName) { + std::string sql("select * from "); + MetaTableHelperTest::appendMetaTableName(std::string("mydb"), &sql); + EXPECT_EQ("select * from mydb.meta", sql); +} |