Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Side by Side Diff: components/safe_browsing_db/prefix_set_unittest.cc

Issue 2321453002: c/browser, c/common, components S-W: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/safe_browsing_db/prefix_set.h" 5 #include "components/safe_browsing_db/prefix_set.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 } 104 }
105 105
106 // Generate a |PrefixSet| file from |shared_prefixes_|, store it in 106 // Generate a |PrefixSet| file from |shared_prefixes_|, store it in
107 // a temporary file, and return the filename in |filenamep|. 107 // a temporary file, and return the filename in |filenamep|.
108 // Returns |true| on success. 108 // Returns |true| on success.
109 bool GetPrefixSetFile(base::FilePath* filenamep) { 109 bool GetPrefixSetFile(base::FilePath* filenamep) {
110 if (!temp_dir_.IsValid() && !temp_dir_.CreateUniqueTempDir()) 110 if (!temp_dir_.IsValid() && !temp_dir_.CreateUniqueTempDir())
111 return false; 111 return false;
112 112
113 base::FilePath filename = temp_dir_.path().AppendASCII("PrefixSetTest"); 113 base::FilePath filename = temp_dir_.GetPath().AppendASCII("PrefixSetTest");
114 114
115 PrefixSetBuilder builder(shared_prefixes_); 115 PrefixSetBuilder builder(shared_prefixes_);
116 if (!builder.GetPrefixSetNoHashes()->WriteFile(filename)) 116 if (!builder.GetPrefixSetNoHashes()->WriteFile(filename))
117 return false; 117 return false;
118 118
119 *filenamep = filename; 119 *filenamep = filename;
120 return true; 120 return true;
121 } 121 }
122 122
123 // Helper function to read the uint32_t value at |offset|, increment it 123 // Helper function to read the uint32_t value at |offset|, increment it
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 const SBFullHash kHash2 = SBFullHashForString("www.evil.com/phishing.html"); 725 const SBFullHash kHash2 = SBFullHashForString("www.evil.com/phishing.html");
726 726
727 EXPECT_TRUE(prefix_set->Exists(kHash1)); 727 EXPECT_TRUE(prefix_set->Exists(kHash1));
728 EXPECT_TRUE(prefix_set->Exists(kHash2)); 728 EXPECT_TRUE(prefix_set->Exists(kHash2));
729 EXPECT_FALSE(prefix_set->PrefixExists(kHash1.prefix)); 729 EXPECT_FALSE(prefix_set->PrefixExists(kHash1.prefix));
730 EXPECT_FALSE(prefix_set->PrefixExists(kHash2.prefix)); 730 EXPECT_FALSE(prefix_set->PrefixExists(kHash2.prefix));
731 } 731 }
732 #endif 732 #endif
733 733
734 } // namespace safe_browsing 734 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | components/safe_browsing_db/v4_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698