| 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 <limits> |
| 8 #include <set> | 9 #include <set> |
| 9 | 10 |
| 11 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 13 #include "base/perftimer.h" | 15 #include "base/perftimer.h" |
| 16 #include "base/rand_util.h" |
| 17 #include "base/scoped_ptr.h" |
| 14 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 15 #include "base/test_file_util.h" | 19 #include "base/test_file_util.h" |
| 16 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 20 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 21 #include "chrome/browser/safe_browsing/safe_browsing_database_impl.h" |
| 17 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/sqlite_compiled_statement.h" | 23 #include "chrome/common/sqlite_compiled_statement.h" |
| 19 #include "chrome/common/sqlite_utils.h" | 24 #include "chrome/common/sqlite_utils.h" |
| 25 #include "googleurl/src/gurl.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 27 |
| 22 // These tests are slow, especially the ones that create databases. So disable | |
| 23 // them by default. | |
| 24 //#define SAFE_BROWSING_DATABASE_TESTS_ENABLED | |
| 25 #ifdef SAFE_BROWSING_DATABASE_TESTS_ENABLED | |
| 26 | |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 // Base class for a safebrowsing database. Derived classes can implement | 30 // Base class for a safebrowsing database. Derived classes can implement |
| 30 // different types of tables to compare performance characteristics. | 31 // different types of tables to compare performance characteristics. |
| 31 class Database { | 32 class Database { |
| 32 public: | 33 public: |
| 33 Database() : db_(NULL) { | 34 Database() : db_(NULL) { |
| 34 } | 35 } |
| 35 | 36 |
| 36 ~Database() { | 37 ~Database() { |
| 37 if (db_) { | 38 if (db_) { |
| 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 FilePath& 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 FilePath filename; |
| 47 PathService::Get(base::DIR_TEMP, &filename); | 47 PathService::Get(base::DIR_TEMP, &filename); |
| 48 filename.push_back(FilePath::kSeparators[0]); | 48 filename = filename.Append(name); |
| 49 filename.append(ASCIIToWide(name)); | |
| 50 | 49 |
| 51 if (create) { | 50 if (create) { |
| 52 DeleteFile(filename.c_str()); | 51 file_util::Delete(filename, false); |
| 53 } else { | 52 } else { |
| 54 DLOG(INFO) << "evicting " << name << " ..."; | 53 DLOG(INFO) << "evicting " << name.value() << " ..."; |
| 55 file_util::EvictFileFromSystemCache(filename.c_str()); | 54 file_util::EvictFileFromSystemCache(filename); |
| 56 DLOG(INFO) << "... evicted"; | 55 DLOG(INFO) << "... evicted"; |
| 57 } | 56 } |
| 58 | 57 |
| 59 if (sqlite3_open(WideToUTF8(filename).c_str(), &db_) != SQLITE_OK) | 58 const std::string sqlite_path = WideToUTF8(filename.ToWStringHack()); |
| 59 if (sqlite3_open(sqlite_path.c_str(), &db_) != SQLITE_OK) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 statement_cache_.set_db(db_); | 62 statement_cache_.set_db(db_); |
| 63 | 63 |
| 64 if (!create) | 64 if (!create) |
| 65 return true; | 65 return true; |
| 66 | 66 |
| 67 return CreateTable(); | 67 return CreateTable(); |
| 68 } | 68 } |
| 69 | 69 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 statement->bind_int(0, host_key); | 190 statement->bind_int(0, host_key); |
| 191 statement->bind_blob(1, prefixes, count * sizeof(int)); | 191 statement->bind_blob(1, prefixes, count * sizeof(int)); |
| 192 return statement->step() == SQLITE_DONE; | 192 return statement->step() == SQLITE_DONE; |
| 193 } | 193 } |
| 194 | 194 |
| 195 std::string GetDBSuffix() { | 195 std::string GetDBSuffix() { |
| 196 return "IndexedWithID"; | 196 return "IndexedWithID"; |
| 197 } | 197 } |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } | 200 } // namespace |
| 201 | 201 |
| 202 class SafeBrowsing: public testing::Test { | 202 class SafeBrowsing: public testing::Test { |
| 203 protected: | 203 protected: |
| 204 // Get the test parameters from the test case's name. | 204 // Get the test parameters from the test case's name. |
| 205 virtual void SetUp() { | 205 virtual void SetUp() { |
| 206 logging::InitLogging( | 206 logging::InitLogging( |
| 207 NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 207 NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| 208 logging::LOCK_LOG_FILE, | 208 logging::LOCK_LOG_FILE, |
| 209 logging::DELETE_OLD_LOG_FILE); | 209 logging::DELETE_OLD_LOG_FILE); |
| 210 | 210 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 DCHECK(index); | 247 DCHECK(index); |
| 248 const char* count_start = test_name.c_str() + ++index; | 248 const char* count_start = test_name.c_str() + ++index; |
| 249 int count = atoi(count_start); | 249 int count = atoi(count_start); |
| 250 int size = count * multiplier; | 250 int size = count * multiplier; |
| 251 | 251 |
| 252 db_name_ = StringPrintf("TestSafeBrowsing"); | 252 db_name_ = StringPrintf("TestSafeBrowsing"); |
| 253 db_name_.append(count_start); | 253 db_name_.append(count_start); |
| 254 db_name_.append(db_->GetDBSuffix()); | 254 db_name_.append(db_->GetDBSuffix()); |
| 255 | 255 |
| 256 ASSERT_TRUE(db_->Init(db_name_, type == WRITE)); | 256 FilePath path = FilePath::FromWStringHack(ASCIIToWide(db_name_)); |
| 257 ASSERT_TRUE(db_->Init(path, type == WRITE)); |
| 257 | 258 |
| 258 if (type == WRITE) { | 259 if (type == WRITE) { |
| 259 WriteEntries(size); | 260 WriteEntries(size); |
| 260 } else if (type == READ) { | 261 } else if (type == READ) { |
| 261 ReadEntries(100); | 262 ReadEntries(100); |
| 262 } else { | 263 } else { |
| 263 CountEntries(); | 264 CountEntries(); |
| 264 } | 265 } |
| 265 } | 266 } |
| 266 | 267 |
| 267 virtual void TearDown() { | 268 virtual void TearDown() { |
| 268 delete db_; | 269 delete db_; |
| 269 } | 270 } |
| 270 | 271 |
| 271 // This writes the given number of entries to the database. | 272 // This writes the given number of entries to the database. |
| 272 void WriteEntries(int count) { | 273 void WriteEntries(int count) { |
| 273 int prefixes[4]; | 274 int prefixes[4]; |
| 274 | 275 |
| 275 SQLTransaction transaction(db_->db()); | 276 SQLTransaction transaction(db_->db()); |
| 276 transaction.Begin(); | 277 transaction.Begin(); |
| 277 | 278 |
| 278 int inc = kint32max / count; | |
| 279 for (int i = 0; i < count; i++) { | 279 for (int i = 0; i < count; i++) { |
| 280 int hostkey; | 280 int hostkey = base::RandInt(std::numeric_limits<int>::min(), |
| 281 rand_s((unsigned int*)&hostkey); | 281 std::numeric_limits<int>::max()); |
| 282 ASSERT_TRUE(db_->Add(hostkey, prefixes, 1)); | 282 ASSERT_TRUE(db_->Add(hostkey, prefixes, 1)); |
| 283 } | 283 } |
| 284 | 284 |
| 285 transaction.Commit(); | 285 transaction.Commit(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 // Read the given number of entries from the database. | 288 // Read the given number of entries from the database. |
| 289 void ReadEntries(int count) { | 289 void ReadEntries(int count) { |
| 290 int prefixes[4]; | 290 int prefixes[4]; |
| 291 | 291 |
| 292 int64 total_ms = 0; | 292 int64 total_ms = 0; |
| 293 | 293 |
| 294 for (int i = 0; i < count; ++i) { | 294 for (int i = 0; i < count; ++i) { |
| 295 int key; | 295 int key = base::RandInt(std::numeric_limits<int>::min(), |
| 296 rand_s((unsigned int*)&key); | 296 std::numeric_limits<int>::max()); |
| 297 | 297 |
| 298 PerfTimer timer; | 298 PerfTimer timer; |
| 299 | 299 |
| 300 int read; | 300 int read; |
| 301 ASSERT_TRUE(db_->Read(key, prefixes, sizeof(prefixes), &read)); | 301 ASSERT_TRUE(db_->Read(key, prefixes, sizeof(prefixes), &read)); |
| 302 | 302 |
| 303 int64 time_ms = timer.Elapsed().InMilliseconds(); | 303 int64 time_ms = timer.Elapsed().InMilliseconds(); |
| 304 total_ms += time_ms; | 304 total_ms += time_ms; |
| 305 DLOG(INFO) << "Read in " << time_ms << " ms."; | 305 DLOG(INFO) << "Read in " << time_ms << " ms."; |
| 306 } | 306 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 325 READ, | 325 READ, |
| 326 COUNT, | 326 COUNT, |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 private: | 329 private: |
| 330 | 330 |
| 331 Database* db_; | 331 Database* db_; |
| 332 std::string db_name_; | 332 std::string db_name_; |
| 333 }; | 333 }; |
| 334 | 334 |
| 335 TEST_F(SafeBrowsing, Write_100K) { | 335 TEST_F(SafeBrowsing, DISABLED_Write_100K) { |
| 336 } | 336 } |
| 337 | 337 |
| 338 TEST_F(SafeBrowsing, Read_100K) { | 338 TEST_F(SafeBrowsing, DISABLED_Read_100K) { |
| 339 } | 339 } |
| 340 | 340 |
| 341 TEST_F(SafeBrowsing, WriteIndexed_100K) { | 341 TEST_F(SafeBrowsing, DISABLED_WriteIndexed_100K) { |
| 342 } | 342 } |
| 343 | 343 |
| 344 TEST_F(SafeBrowsing, ReadIndexed_100K) { | 344 TEST_F(SafeBrowsing, DISABLED_ReadIndexed_100K) { |
| 345 } | 345 } |
| 346 | 346 |
| 347 TEST_F(SafeBrowsing, WriteIndexed_250K) { | 347 TEST_F(SafeBrowsing, DISABLED_WriteIndexed_250K) { |
| 348 } | 348 } |
| 349 | 349 |
| 350 TEST_F(SafeBrowsing, ReadIndexed_250K) { | 350 TEST_F(SafeBrowsing, DISABLED_ReadIndexed_250K) { |
| 351 } | 351 } |
| 352 | 352 |
| 353 TEST_F(SafeBrowsing, WriteIndexed_500K) { | 353 TEST_F(SafeBrowsing, DISABLED_WriteIndexed_500K) { |
| 354 } | 354 } |
| 355 | 355 |
| 356 TEST_F(SafeBrowsing, ReadIndexed_500K) { | 356 TEST_F(SafeBrowsing, DISABLED_ReadIndexed_500K) { |
| 357 } | 357 } |
| 358 | 358 |
| 359 TEST_F(SafeBrowsing, ReadIndexedWithID_250K) { | 359 TEST_F(SafeBrowsing, DISABLED_WriteIndexedWithID_250K) { |
| 360 } | 360 } |
| 361 | 361 |
| 362 TEST_F(SafeBrowsing, WriteIndexedWithID_250K) { | 362 TEST_F(SafeBrowsing, DISABLED_ReadIndexedWithID_250K) { |
| 363 } | 363 } |
| 364 | 364 |
| 365 TEST_F(SafeBrowsing, ReadIndexedWithID_500K) { | 365 TEST_F(SafeBrowsing, DISABLED_WriteIndexedWithID_500K) { |
| 366 } | 366 } |
| 367 | 367 |
| 368 TEST_F(SafeBrowsing, WriteIndexedWithID_500K) { | 368 TEST_F(SafeBrowsing, DISABLED_ReadIndexedWithID_500K) { |
| 369 } | 369 } |
| 370 | 370 |
| 371 TEST_F(SafeBrowsing, CountIndexed_250K) { | 371 TEST_F(SafeBrowsing, DISABLED_CountIndexed_250K) { |
| 372 } | 372 } |
| 373 | 373 |
| 374 TEST_F(SafeBrowsing, CountIndexed_500K) { | 374 TEST_F(SafeBrowsing, DISABLED_CountIndexed_500K) { |
| 375 } | 375 } |
| 376 | 376 |
| 377 TEST_F(SafeBrowsing, CountIndexedWithID_250K) { | 377 TEST_F(SafeBrowsing, DISABLED_CountIndexedWithID_250K) { |
| 378 } | 378 } |
| 379 | 379 |
| 380 TEST_F(SafeBrowsing, CountIndexedWithID_500K) { | 380 TEST_F(SafeBrowsing, DISABLED_CountIndexedWithID_500K) { |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 class SafeBrowsingDatabaseTest { | 384 class SafeBrowsingDatabaseTest { |
| 385 public: | 385 public: |
| 386 SafeBrowsingDatabaseTest(const std::wstring& name) { | 386 SafeBrowsingDatabaseTest(const FilePath& filename) { |
| 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 std::wstring tmp_path; |
| 393 filename_.push_back(FilePath::kSeparators[0]); | 393 PathService::Get(base::DIR_TEMP, &tmp_path); |
| 394 filename_.append(name); | 394 path_ = FilePath::FromWStringHack(tmp_path); |
| 395 path_ = path_.Append(filename); |
| 395 } | 396 } |
| 396 | 397 |
| 397 void Create(int size) { | 398 void Create(int size) { |
| 398 DeleteFile(filename_.c_str()); | 399 file_util::Delete(path_, false); |
| 399 | 400 |
| 400 SafeBrowsingDatabase database; | 401 scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); |
| 401 database.set_synchronous(); | 402 database->SetSynchronous(); |
| 402 EXPECT_TRUE(database.Init(filename_)); | 403 EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); |
| 403 | 404 |
| 404 int chunk_id = 0; | 405 int chunk_id = 0; |
| 405 int total_host_keys = size; | 406 int total_host_keys = size; |
| 406 int host_keys_per_chunk = 100; | 407 int host_keys_per_chunk = 100; |
| 407 | 408 |
| 408 std::deque<SBChunk>* chunks = new std::deque<SBChunk>; | 409 std::deque<SBChunk>* chunks = new std::deque<SBChunk>; |
| 409 | 410 |
| 410 for (int i = 0; i < total_host_keys / host_keys_per_chunk; ++i) { | 411 for (int i = 0; i < total_host_keys / host_keys_per_chunk; ++i) { |
| 411 chunks->push_back(SBChunk()); | 412 chunks->push_back(SBChunk()); |
| 412 chunks->back().chunk_number = ++chunk_id; | 413 chunks->back().chunk_number = ++chunk_id; |
| 413 | 414 |
| 414 for (int j = 0; j < host_keys_per_chunk; ++j) { | 415 for (int j = 0; j < host_keys_per_chunk; ++j) { |
| 415 SBChunkHost host; | 416 SBChunkHost host; |
| 416 rand_s((unsigned int*)&host.host); | 417 host.host = base::RandInt(std::numeric_limits<int>::min(), |
| 418 std::numeric_limits<int>::max()); |
| 417 host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2); | 419 host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2); |
| 418 host.entry->SetPrefixAt(0, 0x2425525); | 420 host.entry->SetPrefixAt(0, 0x2425525); |
| 419 host.entry->SetPrefixAt(1, 0x1536366); | 421 host.entry->SetPrefixAt(1, 0x1536366); |
| 420 | 422 |
| 421 chunks->back().hosts.push_back(host); | 423 chunks->back().hosts.push_back(host); |
| 422 } | 424 } |
| 423 } | 425 } |
| 424 | 426 |
| 425 database.InsertChunks("goog-malware", chunks); | 427 database->InsertChunks("goog-malware", chunks); |
| 426 } | 428 } |
| 427 | 429 |
| 428 void Read(bool use_bloom_filter) { | 430 void Read(bool use_bloom_filter) { |
| 429 int keys_to_read = 500; | 431 int keys_to_read = 500; |
| 430 file_util::EvictFileFromSystemCache(filename_.c_str()); | 432 file_util::EvictFileFromSystemCache(path_); |
| 431 | 433 |
| 432 SafeBrowsingDatabase database; | 434 scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); |
| 433 database.set_synchronous(); | 435 database->SetSynchronous(); |
| 434 EXPECT_TRUE(database.Init(filename_)); | 436 EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); |
| 435 | 437 |
| 436 PerfTimer total_timer; | 438 PerfTimer total_timer; |
| 437 int64 db_ms = 0; | 439 int64 db_ms = 0; |
| 438 int keys_from_db = 0; | 440 int keys_from_db = 0; |
| 439 for (int i = 0; i < keys_to_read; ++i) { | 441 for (int i = 0; i < keys_to_read; ++i) { |
| 440 int key; | 442 int key = base::RandInt(std::numeric_limits<int>::min(), |
| 441 rand_s((unsigned int*)&key); | 443 std::numeric_limits<int>::max()); |
| 442 | 444 |
| 443 std::string url = StringPrintf("http://www.%d.com/blah.html", key); | 445 std::string url = StringPrintf("http://www.%d.com/blah.html", key); |
| 444 | 446 |
| 445 std::string matching_list; | 447 std::string matching_list; |
| 446 std::vector<SBPrefix> prefix_hits; | 448 std::vector<SBPrefix> prefix_hits; |
| 449 std::vector<SBFullHashResult> full_hits; |
| 447 GURL gurl(url); | 450 GURL gurl(url); |
| 448 if (!use_bloom_filter || database.NeedToCheckUrl(gurl)) { | 451 if (!use_bloom_filter || database->NeedToCheckUrl(gurl)) { |
| 449 PerfTimer timer; | 452 PerfTimer timer; |
| 450 database.ContainsUrl(gurl, &matching_list, &prefix_hits); | 453 database->ContainsUrl(gurl, |
| 454 &matching_list, |
| 455 &prefix_hits, |
| 456 &full_hits, |
| 457 base::Time::Now()); |
| 451 | 458 |
| 452 int64 time_ms = timer.Elapsed().InMilliseconds(); | 459 int64 time_ms = timer.Elapsed().InMilliseconds(); |
| 453 | 460 |
| 454 DLOG(INFO) << "Read from db in " << time_ms << " ms."; | 461 DLOG(INFO) << "Read from db in " << time_ms << " ms."; |
| 455 | 462 |
| 456 db_ms += time_ms; | 463 db_ms += time_ms; |
| 457 keys_from_db++; | 464 keys_from_db++; |
| 458 } | 465 } |
| 459 } | 466 } |
| 460 | 467 |
| 461 int64 total_ms = total_timer.Elapsed().InMilliseconds(); | 468 int64 total_ms = total_timer.Elapsed().InMilliseconds(); |
| 462 | 469 |
| 463 DLOG(INFO) << WideToASCII(file_util::GetFilenameFromPath(filename_)) << | 470 DLOG(INFO) << path_.BaseName().value() << " read " << keys_to_read << |
| 464 " read " << keys_to_read << " entries in " << total_ms << " ms. " << | 471 " entries in " << total_ms << " ms. " << keys_from_db << |
| 465 keys_from_db << " keys were read from the db, with average read taking "
<< | 472 " keys were read from the db, with average read taking " << |
| 466 db_ms / keys_from_db << " ms"; | 473 db_ms / keys_from_db << " ms"; |
| 467 } | 474 } |
| 468 | 475 |
| 469 void BuildBloomFilter() { | 476 void BuildBloomFilter() { |
| 470 file_util::EvictFileFromSystemCache(filename_.c_str()); | 477 file_util::EvictFileFromSystemCache(path_); |
| 471 file_util::Delete(SafeBrowsingDatabase::BloomFilterFilename(filename_), fals
e); | 478 file_util::Delete(SafeBrowsingDatabase::BloomFilterFilename( |
| 479 path_.ToWStringHack()), false); |
| 472 | 480 |
| 473 PerfTimer total_timer; | 481 PerfTimer total_timer; |
| 474 | 482 |
| 475 SafeBrowsingDatabase database; | 483 scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); |
| 476 database.set_synchronous(); | 484 database->SetSynchronous(); |
| 477 EXPECT_TRUE(database.Init(filename_)); | 485 EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); |
| 478 | 486 |
| 479 int64 total_ms = total_timer.Elapsed().InMilliseconds(); | 487 int64 total_ms = total_timer.Elapsed().InMilliseconds(); |
| 480 | 488 |
| 481 DLOG(INFO) << WideToASCII(file_util::GetFilenameFromPath(filename_)) << | 489 DLOG(INFO) << path_.BaseName().value() << |
| 482 " built bloom filter in " << total_ms << " ms."; | 490 " built bloom filter in " << total_ms << " ms."; |
| 483 } | 491 } |
| 484 | 492 |
| 485 private: | 493 private: |
| 486 std::wstring filename_; | 494 FilePath path_; |
| 487 }; | 495 }; |
| 488 | 496 |
| 489 // Adds 100K host records. | 497 // Adds 100K host records. |
| 490 TEST(SafeBrowsingDatabase, FillUp100K) { | 498 TEST(SafeBrowsingDatabase, DISABLED_FillUp100K) { |
| 491 SafeBrowsingDatabaseTest db(L"SafeBrowsing100K"); | 499 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing100K"))); |
| 492 db.Create(100000); | 500 db.Create(100000); |
| 493 } | 501 } |
| 494 | 502 |
| 495 // Adds 250K host records. | 503 // Adds 250K host records. |
| 496 TEST(SafeBrowsingDatabase, FillUp250K) { | 504 TEST(SafeBrowsingDatabase, DISABLED_FillUp250K) { |
| 497 SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); | 505 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); |
| 498 db.Create(250000); | 506 db.Create(250000); |
| 499 } | 507 } |
| 500 | 508 |
| 501 // Adds 500K host records. | 509 // Adds 500K host records. |
| 502 TEST(SafeBrowsingDatabase, FillUp500K) { | 510 TEST(SafeBrowsingDatabase, DISABLED_FillUp500K) { |
| 503 SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); | 511 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); |
| 504 db.Create(500000); | 512 db.Create(500000); |
| 505 } | 513 } |
| 506 | 514 |
| 507 // Reads 500 entries and prints the timing. | 515 // Reads 500 entries and prints the timing. |
| 508 TEST(SafeBrowsingDatabase, ReadFrom250K) { | 516 TEST(SafeBrowsingDatabase, DISABLED_ReadFrom250K) { |
| 509 SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); | 517 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); |
| 510 db.Read(false); | 518 db.Read(false); |
| 511 } | 519 } |
| 512 | 520 |
| 513 TEST(SafeBrowsingDatabase, ReadFrom500K) { | 521 TEST(SafeBrowsingDatabase, DISABLED_ReadFrom500K) { |
| 514 SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); | 522 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); |
| 515 db.Read(false); | 523 db.Read(false); |
| 516 } | 524 } |
| 517 | 525 |
| 518 // Read 500 entries with a bloom filter and print the timing. | 526 // Read 500 entries with a bloom filter and print the timing. |
| 519 TEST(SafeBrowsingDatabase, BloomReadFrom250K) { | 527 TEST(SafeBrowsingDatabase, DISABLED_BloomReadFrom250K) { |
| 520 SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); | 528 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); |
| 521 db.Read(true); | 529 db.Read(true); |
| 522 } | 530 } |
| 523 | 531 |
| 524 TEST(SafeBrowsingDatabase, BloomReadFrom500K) { | 532 TEST(SafeBrowsingDatabase, DISABLED_BloomReadFrom500K) { |
| 525 SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); | 533 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); |
| 526 db.Read(true); | 534 db.Read(true); |
| 527 } | 535 } |
| 528 | 536 |
| 529 // Test how long bloom filter creation takes. | 537 // Test how long bloom filter creation takes. |
| 530 TEST(SafeBrowsingDatabase, BuildBloomFilter250K) { | 538 TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter250K) { |
| 531 SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); | 539 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); |
| 532 db.BuildBloomFilter(); | 540 db.BuildBloomFilter(); |
| 533 } | 541 } |
| 534 | 542 |
| 535 TEST(SafeBrowsingDatabase, BuildBloomFilter500K) { | 543 TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter500K) { |
| 536 SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); | 544 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); |
| 537 db.BuildBloomFilter(); | 545 db.BuildBloomFilter(); |
| 538 } | 546 } |
| 539 | |
| 540 #endif | |
| OLD | NEW |