summaryrefslogtreecommitdiffstats
path: root/chrome/browser/meta_table_helper_unittest.cc
blob: 0d8ae5bc4939d3b21a4ff075d91e336bec853ae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
}