OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/login_database.h" | 5 #include "components/password_manager/core/browser/login_database.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 // Helper functions to read the value of the first column of an executed | 69 // Helper functions to read the value of the first column of an executed |
70 // statement if we know its type. You must implement a specialization for | 70 // statement if we know its type. You must implement a specialization for |
71 // every column type you use. | 71 // every column type you use. |
72 template<class T> struct must_be_specialized { | 72 template<class T> struct must_be_specialized { |
73 static const bool is_specialized = false; | 73 static const bool is_specialized = false; |
74 }; | 74 }; |
75 | 75 |
76 template<class T> T GetFirstColumn(const sql::Statement& s) { | 76 template<class T> T GetFirstColumn(const sql::Statement& s) { |
77 COMPILE_ASSERT(must_be_specialized<T>::is_specialized, | 77 static_assert(must_be_specialized<T>::is_specialized, |
78 "Implement a specialization."); | 78 "Implement a specialization."); |
79 } | 79 } |
80 | 80 |
81 template<> int64_t GetFirstColumn(const sql::Statement& s) { | 81 template<> int64_t GetFirstColumn(const sql::Statement& s) { |
82 return s.ColumnInt64(0); | 82 return s.ColumnInt64(0); |
83 }; | 83 }; |
84 | 84 |
85 template<> std::string GetFirstColumn(const sql::Statement& s) { | 85 template<> std::string GetFirstColumn(const sql::Statement& s) { |
86 return s.ColumnString(0); | 86 return s.ColumnString(0); |
87 }; | 87 }; |
88 | 88 |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 LoginDatabaseMigrationTest, | 1523 LoginDatabaseMigrationTest, |
1524 testing::Range(1, kCurrentVersionNumber + 1)); | 1524 testing::Range(1, kCurrentVersionNumber + 1)); |
1525 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, | 1525 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, |
1526 LoginDatabaseMigrationTestV9, | 1526 LoginDatabaseMigrationTestV9, |
1527 testing::Values(9)); | 1527 testing::Values(9)); |
1528 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, | 1528 INSTANTIATE_TEST_CASE_P(MigrationToVCurrent, |
1529 LoginDatabaseMigrationTestBroken, | 1529 LoginDatabaseMigrationTestBroken, |
1530 testing::Range(1, 4)); | 1530 testing::Range(1, 4)); |
1531 | 1531 |
1532 } // namespace password_manager | 1532 } // namespace password_manager |
OLD | NEW |