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 // Unit tests for the SafeBrowsing storage system. | 5 // Unit tests for the SafeBrowsing storage system. |
6 | 6 |
7 #include "app/sql/connection.h" | |
8 #include "app/sql/statement.h" | |
9 #include "base/file_util.h" | 7 #include "base/file_util.h" |
10 #include "base/logging.h" | 8 #include "base/logging.h" |
11 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
12 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
13 #include "base/time.h" | 11 #include "base/time.h" |
14 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 12 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
15 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" | 13 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
16 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" | 14 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" |
17 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
18 #include "crypto/sha2.h" | 16 #include "crypto/sha2.h" |
19 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "sql/connection.h" |
| 19 #include "sql/statement.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
22 | 22 |
23 using base::Time; | 23 using base::Time; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 SBPrefix Sha256Prefix(const std::string& str) { | 27 SBPrefix Sha256Prefix(const std::string& str) { |
28 SBPrefix prefix; | 28 SBPrefix prefix; |
29 crypto::SHA256HashString(str, &prefix, sizeof(prefix)); | 29 crypto::SHA256HashString(str, &prefix, sizeof(prefix)); |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 | 1522 |
1523 // Simply calling |UpdateStarted()| then |UpdateFinished()| does not | 1523 // Simply calling |UpdateStarted()| then |UpdateFinished()| does not |
1524 // update the database file. | 1524 // update the database file. |
1525 ASSERT_TRUE(file_util::SetLastModifiedTime(filename, old_last_modified)); | 1525 ASSERT_TRUE(file_util::SetLastModifiedTime(filename, old_last_modified)); |
1526 ASSERT_TRUE(file_util::GetFileInfo(filename, &before_info)); | 1526 ASSERT_TRUE(file_util::GetFileInfo(filename, &before_info)); |
1527 EXPECT_TRUE(database_->UpdateStarted(&lists)); | 1527 EXPECT_TRUE(database_->UpdateStarted(&lists)); |
1528 database_->UpdateFinished(true); | 1528 database_->UpdateFinished(true); |
1529 ASSERT_TRUE(file_util::GetFileInfo(filename, &after_info)); | 1529 ASSERT_TRUE(file_util::GetFileInfo(filename, &after_info)); |
1530 EXPECT_EQ(before_info.last_modified, after_info.last_modified); | 1530 EXPECT_EQ(before_info.last_modified, after_info.last_modified); |
1531 } | 1531 } |
OLD | NEW |