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/testing_browser_process_test.h" |
23 #include "chrome/test/ui_test_utils.h" | 24 #include "chrome/test/ui_test_utils.h" |
24 #include "sql/statement.h" | 25 #include "sql/statement.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 | 27 |
27 using base::Time; | 28 using base::Time; |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 void AutofillProfile31FromStatement(const sql::Statement& s, | 32 void AutofillProfile31FromStatement(const sql::Statement& s, |
32 AutofillProfile* profile, | 33 AutofillProfile* profile, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 121 } |
121 *date_modified = s.ColumnInt64(5); | 122 *date_modified = s.ColumnInt64(5); |
122 } | 123 } |
123 | 124 |
124 } // anonymous namespace | 125 } // anonymous namespace |
125 | 126 |
126 // The WebDatabaseMigrationTest encapsulates testing of database migrations. | 127 // The WebDatabaseMigrationTest encapsulates testing of database migrations. |
127 // Specifically, these tests are intended to exercise any schema changes in | 128 // Specifically, these tests are intended to exercise any schema changes in |
128 // the WebDatabase and data migrations that occur in | 129 // the WebDatabase and data migrations that occur in |
129 // |WebDatabase::MigrateOldVersionsAsNeeded()|. | 130 // |WebDatabase::MigrateOldVersionsAsNeeded()|. |
130 class WebDatabaseMigrationTest : public testing::Test { | 131 class WebDatabaseMigrationTest : public TestingBrowserProcessTest { |
131 public: | 132 public: |
132 WebDatabaseMigrationTest() {} | 133 WebDatabaseMigrationTest() {} |
133 virtual ~WebDatabaseMigrationTest() {} | 134 virtual ~WebDatabaseMigrationTest() {} |
134 | 135 |
135 virtual void SetUp() { | 136 virtual void SetUp() { |
136 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 137 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
137 } | 138 } |
138 | 139 |
139 protected: | 140 protected: |
140 // Current tested version number. When adding a migration in | 141 // Current tested version number. When adding a migration in |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 1498 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
1498 | 1499 |
1499 // Check version. | 1500 // Check version. |
1500 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); | 1501 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
1501 | 1502 |
1502 // |keywords| |sync_guid| column should have been added. | 1503 // |keywords| |sync_guid| column should have been added. |
1503 EXPECT_TRUE(connection.DoesColumnExist("keywords", "id")); | 1504 EXPECT_TRUE(connection.DoesColumnExist("keywords", "id")); |
1504 EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid")); | 1505 EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid")); |
1505 } | 1506 } |
1506 } | 1507 } |
OLD | NEW |