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 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 prefix_misses, | 313 prefix_misses, |
314 &add_prefixes_result, | 314 &add_prefixes_result, |
315 &add_full_hashes_result)); | 315 &add_full_hashes_result)); |
316 EXPECT_TRUE(add_prefixes_result.empty()); | 316 EXPECT_TRUE(add_prefixes_result.empty()); |
317 EXPECT_TRUE(add_full_hashes_result.empty()); | 317 EXPECT_TRUE(add_full_hashes_result.empty()); |
318 } | 318 } |
319 | 319 |
320 void SafeBrowsingStoreTestDelete(SafeBrowsingStore* store, | 320 void SafeBrowsingStoreTestDelete(SafeBrowsingStore* store, |
321 const base::FilePath& filename) { | 321 const base::FilePath& filename) { |
322 // Delete should work if the file wasn't there in the first place. | 322 // Delete should work if the file wasn't there in the first place. |
323 EXPECT_FALSE(file_util::PathExists(filename)); | 323 EXPECT_FALSE(base::PathExists(filename)); |
324 EXPECT_TRUE(store->Delete()); | 324 EXPECT_TRUE(store->Delete()); |
325 | 325 |
326 // Create a store file. | 326 // Create a store file. |
327 EXPECT_TRUE(store->BeginUpdate()); | 327 EXPECT_TRUE(store->BeginUpdate()); |
328 | 328 |
329 EXPECT_TRUE(store->BeginChunk()); | 329 EXPECT_TRUE(store->BeginChunk()); |
330 store->SetAddChunk(kAddChunk1); | 330 store->SetAddChunk(kAddChunk1); |
331 EXPECT_TRUE(store->WriteAddPrefix(kAddChunk1, kHash1.prefix)); | 331 EXPECT_TRUE(store->WriteAddPrefix(kAddChunk1, kHash1.prefix)); |
332 EXPECT_TRUE(store->WriteAddPrefix(kAddChunk1, kHash2.prefix)); | 332 EXPECT_TRUE(store->WriteAddPrefix(kAddChunk1, kHash2.prefix)); |
333 | 333 |
334 store->SetSubChunk(kSubChunk1); | 334 store->SetSubChunk(kSubChunk1); |
335 EXPECT_TRUE(store->WriteSubPrefix(kSubChunk1, kAddChunk3, kHash3.prefix)); | 335 EXPECT_TRUE(store->WriteSubPrefix(kSubChunk1, kAddChunk3, kHash3.prefix)); |
336 EXPECT_TRUE(store->FinishChunk()); | 336 EXPECT_TRUE(store->FinishChunk()); |
337 | 337 |
338 std::vector<SBAddFullHash> pending_adds; | 338 std::vector<SBAddFullHash> pending_adds; |
339 std::set<SBPrefix> prefix_misses; | 339 std::set<SBPrefix> prefix_misses; |
340 SBAddPrefixes add_prefixes_result; | 340 SBAddPrefixes add_prefixes_result; |
341 std::vector<SBAddFullHash> add_full_hashes_result; | 341 std::vector<SBAddFullHash> add_full_hashes_result; |
342 | 342 |
343 EXPECT_TRUE(store->FinishUpdate(pending_adds, | 343 EXPECT_TRUE(store->FinishUpdate(pending_adds, |
344 prefix_misses, | 344 prefix_misses, |
345 &add_prefixes_result, | 345 &add_prefixes_result, |
346 &add_full_hashes_result)); | 346 &add_full_hashes_result)); |
347 | 347 |
348 EXPECT_TRUE(file_util::PathExists(filename)); | 348 EXPECT_TRUE(base::PathExists(filename)); |
349 EXPECT_TRUE(store->Delete()); | 349 EXPECT_TRUE(store->Delete()); |
350 EXPECT_FALSE(file_util::PathExists(filename)); | 350 EXPECT_FALSE(base::PathExists(filename)); |
351 } | 351 } |
OLD | NEW |