Chromium Code Reviews| Index: chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc |
| diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc |
| index 765b4702a6daa1373ed62d7860215067b7668bce..0df4be6c33ab3daf45731fb7b129dcaef1dd4500 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc |
| +++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/files/scoped_temp_dir.h" |
| #include "base/md5.h" |
| #include "base/path_service.h" |
| +#include "base/test/test_simple_task_runner.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "testing/platform_test.h" |
| @@ -40,6 +41,10 @@ namespace safe_browsing { |
| class SafeBrowsingStoreFileTest : public PlatformTest { |
| public: |
| + SafeBrowsingStoreFileTest() |
| + : task_runner_(new base::TestSimpleTaskRunner), |
| + corruption_detected_(false) {} |
| + |
| void SetUp() override { |
| PlatformTest::SetUp(); |
| @@ -48,7 +53,7 @@ class SafeBrowsingStoreFileTest : public PlatformTest { |
| filename_ = temp_dir_.path(); |
| filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); |
| - store_.reset(new SafeBrowsingStoreFile()); |
| + store_.reset(new SafeBrowsingStoreFile(task_runner_)); |
| store_->Init(filename_, |
| base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected, |
| base::Unretained(this))); |
| @@ -112,6 +117,7 @@ class SafeBrowsingStoreFileTest : public PlatformTest { |
| return shard_stride; |
| } |
| + scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
| base::ScopedTempDir temp_dir_; |
| base::FilePath filename_; |
| scoped_ptr<SafeBrowsingStoreFile> store_; |
| @@ -461,7 +467,7 @@ TEST_F(SafeBrowsingStoreFileTest, DeleteTemp) { |
| // Pull the rug out from under the existing store, simulating a |
| // crash. |
| - store_.reset(new SafeBrowsingStoreFile()); |
| + store_.reset(new SafeBrowsingStoreFile(task_runner_)); |
| store_->Init(filename_, base::Closure()); |
| EXPECT_FALSE(base::PathExists(filename_)); |
| EXPECT_TRUE(base::PathExists(temp_file)); |
| @@ -748,7 +754,7 @@ TEST_F(SafeBrowsingStoreFileTest, Version7) { |
| ASSERT_TRUE(base::CopyFile(golden_path, filename_)); |
| // Reset the store to make sure it re-reads the file. |
| - store_.reset(new SafeBrowsingStoreFile()); |
| + store_.reset(new SafeBrowsingStoreFile(task_runner_)); |
|
gab
2015/02/19 14:38:23
ASSERT_TRUE(!task_runner_->HasPendingTasks());
be
Alexei Svitkine (slow)
2015/02/20 15:42:44
Done.
|
| store_->Init(filename_, |
| base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected, |
| base::Unretained(this))); |
| @@ -781,7 +787,7 @@ TEST_F(SafeBrowsingStoreFileTest, Version8) { |
| ASSERT_TRUE(base::CopyFile(golden_path, filename_)); |
| // Reset the store to make sure it re-reads the file. |
| - store_.reset(new SafeBrowsingStoreFile()); |
| + store_.reset(new SafeBrowsingStoreFile(task_runner_)); |
| store_->Init(filename_, |
| base::Bind(&SafeBrowsingStoreFileTest::OnCorruptionDetected, |
| base::Unretained(this))); |