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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // "components/test/data/web_database" and returned in the string |contents|. | 210 // "components/test/data/web_database" and returned in the string |contents|. |
211 // Returns true if the file exists and is read successfully, false otherwise. | 211 // Returns true if the file exists and is read successfully, false otherwise. |
212 bool GetWebDatabaseData(const base::FilePath& file, std::string* contents) { | 212 bool GetWebDatabaseData(const base::FilePath& file, std::string* contents) { |
213 base::FilePath source_path; | 213 base::FilePath source_path; |
214 PathService::Get(base::DIR_SOURCE_ROOT, &source_path); | 214 PathService::Get(base::DIR_SOURCE_ROOT, &source_path); |
215 source_path = source_path.AppendASCII("components"); | 215 source_path = source_path.AppendASCII("components"); |
216 source_path = source_path.AppendASCII("test"); | 216 source_path = source_path.AppendASCII("test"); |
217 source_path = source_path.AppendASCII("data"); | 217 source_path = source_path.AppendASCII("data"); |
218 source_path = source_path.AppendASCII("web_database"); | 218 source_path = source_path.AppendASCII("web_database"); |
219 source_path = source_path.Append(file); | 219 source_path = source_path.Append(file); |
220 return file_util::PathExists(source_path) && | 220 return base::PathExists(source_path) && |
221 file_util::ReadFileToString(source_path, contents); | 221 file_util::ReadFileToString(source_path, contents); |
222 } | 222 } |
223 | 223 |
224 static int VersionFromConnection(sql::Connection* connection) { | 224 static int VersionFromConnection(sql::Connection* connection) { |
225 // Get version. | 225 // Get version. |
226 sql::Statement s(connection->GetUniqueStatement( | 226 sql::Statement s(connection->GetUniqueStatement( |
227 "SELECT value FROM meta WHERE key='version'")); | 227 "SELECT value FROM meta WHERE key='version'")); |
228 if (!s.Step()) | 228 if (!s.Step()) |
229 return 0; | 229 return 0; |
230 return s.ColumnInt(0); | 230 return s.ColumnInt(0); |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); | 2018 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); |
2019 | 2019 |
2020 // Check version. | 2020 // Check version. |
2021 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); | 2021 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
2022 | 2022 |
2023 // A new column should have been created in both tables. | 2023 // A new column should have been created in both tables. |
2024 EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "origin")); | 2024 EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "origin")); |
2025 EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "origin")); | 2025 EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "origin")); |
2026 } | 2026 } |
2027 } | 2027 } |
OLD | NEW |