OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 statement_cache_.Cleanup(); | 38 statement_cache_.Cleanup(); |
39 sqlite3_close(db_); | 39 sqlite3_close(db_); |
40 db_ = NULL; | 40 db_ = NULL; |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 bool Init(const std::string& name, bool create) { | 44 bool Init(const std::string& name, bool create) { |
45 // get an empty file for the test DB | 45 // get an empty file for the test DB |
46 std::wstring filename; | 46 std::wstring filename; |
47 PathService::Get(base::DIR_TEMP, &filename); | 47 PathService::Get(base::DIR_TEMP, &filename); |
48 filename.push_back(file_util::kPathSeparator); | 48 filename.push_back(FilePath::kSeparators[0]); |
49 filename.append(ASCIIToWide(name)); | 49 filename.append(ASCIIToWide(name)); |
50 | 50 |
51 if (create) { | 51 if (create) { |
52 DeleteFile(filename.c_str()); | 52 DeleteFile(filename.c_str()); |
53 } else { | 53 } else { |
54 DLOG(INFO) << "evicting " << name << " ..."; | 54 DLOG(INFO) << "evicting " << name << " ..."; |
55 file_util::EvictFileFromSystemCache(filename.c_str()); | 55 file_util::EvictFileFromSystemCache(filename.c_str()); |
56 DLOG(INFO) << "... evicted"; | 56 DLOG(INFO) << "... evicted"; |
57 } | 57 } |
58 | 58 |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 class SafeBrowsingDatabaseTest { | 384 class SafeBrowsingDatabaseTest { |
385 public: | 385 public: |
386 SafeBrowsingDatabaseTest(const std::wstring& name) { | 386 SafeBrowsingDatabaseTest(const std::wstring& name) { |
387 logging::InitLogging( | 387 logging::InitLogging( |
388 NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 388 NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
389 logging::LOCK_LOG_FILE, | 389 logging::LOCK_LOG_FILE, |
390 logging::DELETE_OLD_LOG_FILE); | 390 logging::DELETE_OLD_LOG_FILE); |
391 | 391 |
392 PathService::Get(base::DIR_TEMP, &filename_); | 392 PathService::Get(base::DIR_TEMP, &filename_); |
393 filename_.push_back(file_util::kPathSeparator); | 393 filename_.push_back(FilePath::kSeparators[0]); |
394 filename_.append(name); | 394 filename_.append(name); |
395 } | 395 } |
396 | 396 |
397 void Create(int size) { | 397 void Create(int size) { |
398 DeleteFile(filename_.c_str()); | 398 DeleteFile(filename_.c_str()); |
399 | 399 |
400 SafeBrowsingDatabase database; | 400 SafeBrowsingDatabase database; |
401 database.set_synchronous(); | 401 database.set_synchronous(); |
402 EXPECT_TRUE(database.Init(filename_)); | 402 EXPECT_TRUE(database.Init(filename_)); |
403 | 403 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); | 531 SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); |
532 db.BuildBloomFilter(); | 532 db.BuildBloomFilter(); |
533 } | 533 } |
534 | 534 |
535 TEST(SafeBrowsingDatabase, BuildBloomFilter500K) { | 535 TEST(SafeBrowsingDatabase, BuildBloomFilter500K) { |
536 SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); | 536 SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); |
537 db.BuildBloomFilter(); | 537 db.BuildBloomFilter(); |
538 } | 538 } |
539 | 539 |
540 #endif | 540 #endif |
OLD | NEW |