| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/autofill/autofill_profile.h" | 15 #include "chrome/browser/autofill/autofill_profile.h" |
| 16 #include "chrome/browser/autofill/autofill_type.h" | 16 #include "chrome/browser/autofill/autofill_type.h" |
| 17 #include "chrome/browser/autofill/credit_card.h" | 17 #include "chrome/browser/autofill/credit_card.h" |
| 18 #include "chrome/browser/webdata/autofill_change.h" | 18 #include "chrome/browser/webdata/autofill_change.h" |
| 19 #include "chrome/browser/webdata/autofill_entry.h" | 19 #include "chrome/browser/webdata/autofill_entry.h" |
| 20 #include "chrome/browser/webdata/web_database.h" | 20 #include "chrome/browser/webdata/web_database.h" |
| 21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/common/guid.h" | 22 #include "chrome/common/guid.h" |
| 23 #include "chrome/test/base/testing_browser_process_test.h" | |
| 24 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 25 #include "sql/statement.h" | 24 #include "sql/statement.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 26 |
| 28 using base::Time; | 27 using base::Time; |
| 29 | 28 |
| 30 namespace { | 29 namespace { |
| 31 | 30 |
| 32 void AutofillProfile31FromStatement(const sql::Statement& s, | 31 void AutofillProfile31FromStatement(const sql::Statement& s, |
| 33 AutofillProfile* profile, | 32 AutofillProfile* profile, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 120 } |
| 122 *date_modified = s.ColumnInt64(5); | 121 *date_modified = s.ColumnInt64(5); |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // anonymous namespace | 124 } // anonymous namespace |
| 126 | 125 |
| 127 // The WebDatabaseMigrationTest encapsulates testing of database migrations. | 126 // The WebDatabaseMigrationTest encapsulates testing of database migrations. |
| 128 // Specifically, these tests are intended to exercise any schema changes in | 127 // Specifically, these tests are intended to exercise any schema changes in |
| 129 // the WebDatabase and data migrations that occur in | 128 // the WebDatabase and data migrations that occur in |
| 130 // |WebDatabase::MigrateOldVersionsAsNeeded()|. | 129 // |WebDatabase::MigrateOldVersionsAsNeeded()|. |
| 131 class WebDatabaseMigrationTest : public TestingBrowserProcessTest { | 130 class WebDatabaseMigrationTest : public testing::Test { |
| 132 public: | 131 public: |
| 133 WebDatabaseMigrationTest() {} | 132 WebDatabaseMigrationTest() {} |
| 134 virtual ~WebDatabaseMigrationTest() {} | 133 virtual ~WebDatabaseMigrationTest() {} |
| 135 | 134 |
| 136 virtual void SetUp() { | 135 virtual void SetUp() { |
| 137 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 136 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 138 } | 137 } |
| 139 | 138 |
| 140 protected: | 139 protected: |
| 141 // Current tested version number. When adding a migration in | 140 // Current tested version number. When adding a migration in |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 1497 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 1499 | 1498 |
| 1500 // Check version. | 1499 // Check version. |
| 1501 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); | 1500 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
| 1502 | 1501 |
| 1503 // |keywords| |sync_guid| column should have been added. | 1502 // |keywords| |sync_guid| column should have been added. |
| 1504 EXPECT_TRUE(connection.DoesColumnExist("keywords", "id")); | 1503 EXPECT_TRUE(connection.DoesColumnExist("keywords", "id")); |
| 1505 EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid")); | 1504 EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid")); |
| 1506 } | 1505 } |
| 1507 } | 1506 } |
| OLD | NEW |