| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/history/android/android_urls_database.h" | 5 #include "chrome/browser/history/android/android_urls_database.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 history_db_name_)); | 38 history_db_name_)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 FilePath history_db_name_; | 42 FilePath history_db_name_; |
| 43 scoped_ptr<TestingProfile> profile_; | 43 scoped_ptr<TestingProfile> profile_; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 TEST_F(AndroidURLsMigrationTest, MigrateToVersion22) { | 46 TEST_F(AndroidURLsMigrationTest, MigrateToVersion22) { |
| 47 HistoryDatabase db; | 47 HistoryDatabase db; |
| 48 ASSERT_EQ(sql::INIT_OK, db.Init(history_db_name_, profile_->GetPath())); | 48 ASSERT_EQ(sql::INIT_OK, db.Init(history_db_name_)); |
| 49 // Migration has done. | 49 // Migration has done. |
| 50 // The column of previous table shouldn't exist. | 50 // The column of previous table shouldn't exist. |
| 51 EXPECT_FALSE(db.GetDB().DoesColumnExist("android_urls", "bookmark")); | 51 EXPECT_FALSE(db.GetDB().DoesColumnExist("android_urls", "bookmark")); |
| 52 sql::Statement statement(db.GetDB().GetUniqueStatement( | 52 sql::Statement statement(db.GetDB().GetUniqueStatement( |
| 53 "SELECT id, url_id, raw_url FROM android_urls ORDER BY id ASC")); | 53 "SELECT id, url_id, raw_url FROM android_urls ORDER BY id ASC")); |
| 54 ASSERT_TRUE(statement.Step()); | 54 ASSERT_TRUE(statement.Step()); |
| 55 EXPECT_EQ(1, statement.ColumnInt64(0)); | 55 EXPECT_EQ(1, statement.ColumnInt64(0)); |
| 56 EXPECT_EQ("http://google.com/", statement.ColumnString(2)); | 56 EXPECT_EQ("http://google.com/", statement.ColumnString(2)); |
| 57 EXPECT_EQ(1, statement.ColumnInt64(1)); | 57 EXPECT_EQ(1, statement.ColumnInt64(1)); |
| 58 | 58 |
| 59 ASSERT_TRUE(statement.Step()); | 59 ASSERT_TRUE(statement.Step()); |
| 60 EXPECT_EQ(4, statement.ColumnInt64(0)); | 60 EXPECT_EQ(4, statement.ColumnInt64(0)); |
| 61 EXPECT_EQ("www.google.com/", statement.ColumnString(2)); | 61 EXPECT_EQ("www.google.com/", statement.ColumnString(2)); |
| 62 EXPECT_EQ(3, statement.ColumnInt64(1)); | 62 EXPECT_EQ(3, statement.ColumnInt64(1)); |
| 63 | 63 |
| 64 EXPECT_FALSE(statement.Step()); | 64 EXPECT_FALSE(statement.Step()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace history | 67 } // namespace history |
| OLD | NEW |