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/affiliation_database.h" | 5 #include "components/password_manager/core/browser/affiliation_database.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/macros.h" |
9 #include "sql/test/scoped_error_ignorer.h" | 12 #include "sql/test/scoped_error_ignorer.h" |
10 #include "sql/test/test_helpers.h" | 13 #include "sql/test/test_helpers.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/sqlite/sqlite3.h" | 16 #include "third_party/sqlite/sqlite3.h" |
14 | 17 |
15 namespace password_manager { | 18 namespace password_manager { |
16 | 19 |
17 namespace { | 20 namespace { |
18 | 21 |
19 const char kTestFacetURI1[] = "https://alpha.example.com"; | 22 const char kTestFacetURI1[] = "https://alpha.example.com"; |
20 const char kTestFacetURI2[] = "https://beta.example.com"; | 23 const char kTestFacetURI2[] = "https://beta.example.com"; |
21 const char kTestFacetURI3[] = "https://gamma.example.com"; | 24 const char kTestFacetURI3[] = "https://gamma.example.com"; |
22 const char kTestFacetURI4[] = "https://delta.example.com"; | 25 const char kTestFacetURI4[] = "https://delta.example.com"; |
23 const char kTestFacetURI5[] = "https://epsilon.example.com"; | 26 const char kTestFacetURI5[] = "https://epsilon.example.com"; |
24 const char kTestFacetURI6[] = "https://zeta.example.com"; | 27 const char kTestFacetURI6[] = "https://zeta.example.com"; |
25 | 28 |
26 const char kTestAndroidFacetURI[] = "android://hash@com.example.android"; | 29 const char kTestAndroidFacetURI[] = "android://hash@com.example.android"; |
27 | 30 |
28 const int64 kTestTimeUs1 = 1000000; | 31 const int64_t kTestTimeUs1 = 1000000; |
29 const int64 kTestTimeUs2 = 2000000; | 32 const int64_t kTestTimeUs2 = 2000000; |
30 const int64 kTestTimeUs3 = 3000000; | 33 const int64_t kTestTimeUs3 = 3000000; |
31 | 34 |
32 void ExpectEquivalenceClassesAreEqual( | 35 void ExpectEquivalenceClassesAreEqual( |
33 const AffiliatedFacetsWithUpdateTime& expectation, | 36 const AffiliatedFacetsWithUpdateTime& expectation, |
34 const AffiliatedFacetsWithUpdateTime& reality) { | 37 const AffiliatedFacetsWithUpdateTime& reality) { |
35 EXPECT_EQ(expectation.last_update_time, reality.last_update_time); | 38 EXPECT_EQ(expectation.last_update_time, reality.last_update_time); |
36 EXPECT_THAT(reality.facets, | 39 EXPECT_THAT(reality.facets, |
37 testing::UnorderedElementsAreArray(reality.facets)); | 40 testing::UnorderedElementsAreArray(reality.facets)); |
38 } | 41 } |
39 | 42 |
40 AffiliatedFacetsWithUpdateTime TestEquivalenceClass1() { | 43 AffiliatedFacetsWithUpdateTime TestEquivalenceClass1() { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // Verify that all files get deleted. | 300 // Verify that all files get deleted. |
298 TEST_F(AffiliationDatabaseTest, Delete) { | 301 TEST_F(AffiliationDatabaseTest, Delete) { |
299 ASSERT_NO_FATAL_FAILURE(StoreInitialTestData()); | 302 ASSERT_NO_FATAL_FAILURE(StoreInitialTestData()); |
300 CloseDatabase(); | 303 CloseDatabase(); |
301 | 304 |
302 AffiliationDatabase::Delete(db_path()); | 305 AffiliationDatabase::Delete(db_path()); |
303 EXPECT_TRUE(base::IsDirectoryEmpty(db_path().DirName())); | 306 EXPECT_TRUE(base::IsDirectoryEmpty(db_path().DirName())); |
304 } | 307 } |
305 | 308 |
306 } // namespace password_manager | 309 } // namespace password_manager |
OLD | NEW |