OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 WaitForTasksOnTaskRunner(); | 464 WaitForTasksOnTaskRunner(); |
465 EXPECT_EQ(true, created_and_called_back_); | 465 EXPECT_EQ(true, created_and_called_back_); |
466 | 466 |
467 // Doesn't exist in out list | 467 // Doesn't exist in out list |
468 const ListIdentifier bogus_id(LINUX_PLATFORM, CHROME_EXTENSION, | 468 const ListIdentifier bogus_id(LINUX_PLATFORM, CHROME_EXTENSION, |
469 CSD_WHITELIST); | 469 CSD_WHITELIST); |
470 | 470 |
471 EXPECT_TRUE(v4_database_->AreStoresAvailable( | 471 EXPECT_TRUE(v4_database_->AreStoresAvailable( |
472 StoresToCheck({linux_malware_id_, win_malware_id_}))); | 472 StoresToCheck({linux_malware_id_, win_malware_id_}))); |
473 | 473 |
474 EXPECT_FALSE(v4_database_->AreStoresAvailable( | 474 EXPECT_TRUE( |
| 475 v4_database_->AreStoresAvailable(StoresToCheck({linux_malware_id_}))); |
| 476 |
| 477 EXPECT_TRUE(v4_database_->AreStoresAvailable( |
475 StoresToCheck({linux_malware_id_, bogus_id}))); | 478 StoresToCheck({linux_malware_id_, bogus_id}))); |
476 | 479 |
477 EXPECT_FALSE(v4_database_->AreStoresAvailable(StoresToCheck({bogus_id}))); | 480 EXPECT_FALSE(v4_database_->AreStoresAvailable(StoresToCheck({bogus_id}))); |
478 } | 481 } |
479 | 482 |
480 // Test to ensure that the callback to the database is dropped when the database | 483 // Test to ensure that the callback to the database is dropped when the database |
481 // gets destroyed. See http://crbug.com/683147#c5 for more details. | 484 // gets destroyed. See http://crbug.com/683147#c5 for more details. |
482 TEST_F(V4DatabaseTest, UsingWeakPtrDropsCallback) { | 485 TEST_F(V4DatabaseTest, UsingWeakPtrDropsCallback) { |
483 RegisterFactory(); | 486 RegisterFactory(); |
484 | 487 |
(...skipping 23 matching lines...) Expand all Loading... |
508 // Step 3: Before V4Store::ApplyUpdate gets executed on the task runner, | 511 // Step 3: Before V4Store::ApplyUpdate gets executed on the task runner, |
509 // destroy the database. This posts ~V4Database() on the task runner. | 512 // destroy the database. This posts ~V4Database() on the task runner. |
510 V4Database::Destroy(std::move(v4_database_)); | 513 V4Database::Destroy(std::move(v4_database_)); |
511 | 514 |
512 // Step 4: Wait for the task runner to go to completion. The test should | 515 // Step 4: Wait for the task runner to go to completion. The test should |
513 // finish to completion and the |null_callback| should not get called. | 516 // finish to completion and the |null_callback| should not get called. |
514 WaitForTasksOnTaskRunner(); | 517 WaitForTasksOnTaskRunner(); |
515 } | 518 } |
516 | 519 |
517 } // namespace safe_browsing | 520 } // namespace safe_browsing |
OLD | NEW |