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 "chrome/browser/safe_browsing/safe_browsing_store_file.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 const SBPrefix kMinSBPrefix = 0u; | 34 const SBPrefix kMinSBPrefix = 0u; |
35 const SBPrefix kMaxSBPrefix = ~kMinSBPrefix; | 35 const SBPrefix kMaxSBPrefix = ~kMinSBPrefix; |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 namespace safe_browsing { | 39 namespace safe_browsing { |
40 | 40 |
41 class SafeBrowsingStoreFileTest : public PlatformTest { | 41 class SafeBrowsingStoreFileTest : public PlatformTest { |
42 public: | 42 public: |
43 virtual void SetUp() { | 43 void SetUp() override { |
44 PlatformTest::SetUp(); | 44 PlatformTest::SetUp(); |
45 | 45 |
46 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 46 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
47 | 47 |
48 filename_ = temp_dir_.path(); | 48 filename_ = temp_dir_.path(); |
49 filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); | 49 filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); |
50 | 50 |
51 store_.reset(new SafeBrowsingStoreFile()); | 51 store_.reset(new SafeBrowsingStoreFile()); |
52 store_->Init(filename_, | 52 store_->Init(filename_, |
53 base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected, | 53 base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected, |
54 base::Unretained(this))); | 54 base::Unretained(this))); |
55 corruption_detected_ = false; | 55 corruption_detected_ = false; |
56 } | 56 } |
57 virtual void TearDown() { | 57 void TearDown() override { |
58 if (store_.get()) | 58 if (store_.get()) |
59 store_->Delete(); | 59 store_->Delete(); |
60 store_.reset(); | 60 store_.reset(); |
61 | 61 |
62 PlatformTest::TearDown(); | 62 PlatformTest::TearDown(); |
63 } | 63 } |
64 | 64 |
65 void OnCorruptionDetected() { | 65 void OnCorruptionDetected() { |
66 corruption_detected_ = true; | 66 corruption_detected_ = true; |
67 } | 67 } |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 std::vector<SBPrefix> prefixes_result; | 835 std::vector<SBPrefix> prefixes_result; |
836 builder.GetPrefixSetNoHashes()->GetPrefixes(&prefixes_result); | 836 builder.GetPrefixSetNoHashes()->GetPrefixes(&prefixes_result); |
837 ASSERT_EQ(1U, prefixes_result.size()); | 837 ASSERT_EQ(1U, prefixes_result.size()); |
838 EXPECT_EQ(kHash1.prefix, prefixes_result[0]); | 838 EXPECT_EQ(kHash1.prefix, prefixes_result[0]); |
839 EXPECT_TRUE(add_full_hashes_result.empty()); | 839 EXPECT_TRUE(add_full_hashes_result.empty()); |
840 } | 840 } |
841 } | 841 } |
842 #endif | 842 #endif |
843 | 843 |
844 } // namespace safe_browsing | 844 } // namespace safe_browsing |
OLD | NEW |