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

Side by Side Diff: chrome/browser/history/android/android_urls_database_unittest.cc

Issue 10067030: Upgrade the history database to version 23 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync and update test data Created 8 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/history/android/android_urls_database.h"
6
7 #include "base/file_path.h"
8 #include "base/file_util.h"
9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h"
11 #include "chrome/browser/history/history_database.h"
12 #include "chrome/browser/history/history_unittest_base.h"
13 #include "chrome/common/chrome_constants.h"
14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/test/base/testing_profile.h"
16
17 namespace history {
18
19 class AndroidURLsMigrationTest : public HistoryUnitTestBase {
20 public:
21 AndroidURLsMigrationTest() {
22 }
23 ~AndroidURLsMigrationTest() {
24 }
25
26 protected:
27 virtual void SetUp() {
28 profile_.reset(new TestingProfile);
29
30 FilePath data_path;
31 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
32 data_path = data_path.AppendASCII("History");
33
34 history_db_name_ = profile_->GetPath().Append(chrome::kHistoryFilename);
35 // Set up history as they would be before migration.
36 ASSERT_NO_FATAL_FAILURE(
37 ExecuteSQLScript(data_path.AppendASCII("history.21.sql"),
38 history_db_name_));
39 }
40
41 protected:
42 FilePath history_db_name_;
43 scoped_ptr<TestingProfile> profile_;
44 };
45
46 TEST_F(AndroidURLsMigrationTest, MigrateToVersion22) {
47 HistoryDatabase db;
48 ASSERT_EQ(sql::INIT_OK, db.Init(history_db_name_, profile_->GetPath()));
49 // Migration has done.
50 // The column of previous table shouldn't exist.
51 EXPECT_FALSE(db.GetDB().DoesColumnExist("android_urls", "bookmark"));
52 sql::Statement statement(db.GetDB().GetUniqueStatement(
53 "SELECT id, url_id, raw_url FROM android_urls ORDER BY id ASC"));
54 ASSERT_TRUE(statement.Step());
55 EXPECT_EQ(1, statement.ColumnInt64(0));
56 EXPECT_EQ("http://google.com/", statement.ColumnString(2));
57 EXPECT_EQ(1, statement.ColumnInt64(1));
58
59 ASSERT_TRUE(statement.Step());
60 EXPECT_EQ(4, statement.ColumnInt64(0));
61 EXPECT_EQ("www.google.com/", statement.ColumnString(2));
62 EXPECT_EQ(3, statement.ColumnInt64(1));
63
64 EXPECT_FALSE(statement.Step());
65 }
66
67 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/android/android_urls_database.cc ('k') | chrome/browser/history/history_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698