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/files/file_util.h" | 7 #include "base/files/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/macros.h" | 10 #include "base/macros.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 protected: | 81 protected: |
82 // Current tested version number. When adding a migration in | 82 // Current tested version number. When adding a migration in |
83 // |WebDatabase::MigrateOldVersionsAsNeeded()| and changing the version number | 83 // |WebDatabase::MigrateOldVersionsAsNeeded()| and changing the version number |
84 // |kCurrentVersionNumber| this value should change to reflect the new version | 84 // |kCurrentVersionNumber| this value should change to reflect the new version |
85 // number and a new migration test added below. | 85 // number and a new migration test added below. |
86 static const int kCurrentTestedVersionNumber; | 86 static const int kCurrentTestedVersionNumber; |
87 | 87 |
88 base::FilePath GetDatabasePath() { | 88 base::FilePath GetDatabasePath() { |
89 const base::FilePath::CharType kWebDatabaseFilename[] = | 89 const base::FilePath::CharType kWebDatabaseFilename[] = |
90 FILE_PATH_LITERAL("TestWebDatabase.sqlite3"); | 90 FILE_PATH_LITERAL("TestWebDatabase.sqlite3"); |
91 return temp_dir_.path().Append(base::FilePath(kWebDatabaseFilename)); | 91 return temp_dir_.GetPath().Append(base::FilePath(kWebDatabaseFilename)); |
92 } | 92 } |
93 | 93 |
94 // The textual contents of |file| are read from | 94 // The textual contents of |file| are read from |
95 // "components/test/data/web_database" and returned in the string |contents|. | 95 // "components/test/data/web_database" and returned in the string |contents|. |
96 // Returns true if the file exists and is read successfully, false otherwise. | 96 // Returns true if the file exists and is read successfully, false otherwise. |
97 bool GetWebDatabaseData(const base::FilePath& file, std::string* contents) { | 97 bool GetWebDatabaseData(const base::FilePath& file, std::string* contents) { |
98 base::FilePath source_path; | 98 base::FilePath source_path; |
99 PathService::Get(base::DIR_SOURCE_ROOT, &source_path); | 99 PathService::Get(base::DIR_SOURCE_ROOT, &source_path); |
100 source_path = source_path.AppendASCII("components"); | 100 source_path = source_path.AppendASCII("components"); |
101 source_path = source_path.AppendASCII("test"); | 101 source_path = source_path.AppendASCII("test"); |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 EXPECT_TRUE(connection.DoesColumnExist("masked_credit_cards", | 1062 EXPECT_TRUE(connection.DoesColumnExist("masked_credit_cards", |
1063 "billing_address_id")); | 1063 "billing_address_id")); |
1064 | 1064 |
1065 sql::Statement read_masked(connection.GetUniqueStatement( | 1065 sql::Statement read_masked(connection.GetUniqueStatement( |
1066 "SELECT name_on_card, billing_address_id FROM masked_credit_cards")); | 1066 "SELECT name_on_card, billing_address_id FROM masked_credit_cards")); |
1067 ASSERT_TRUE(read_masked.Step()); | 1067 ASSERT_TRUE(read_masked.Step()); |
1068 EXPECT_EQ("Alice", read_masked.ColumnString(0)); | 1068 EXPECT_EQ("Alice", read_masked.ColumnString(0)); |
1069 EXPECT_TRUE(read_masked.ColumnString(1).empty()); | 1069 EXPECT_TRUE(read_masked.ColumnString(1).empty()); |
1070 } | 1070 } |
1071 } | 1071 } |
OLD | NEW |