| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_file.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
| 6 #include "chrome/browser/safe_browsing/safe_browsing_store_sqlite.h" | 6 #include "chrome/browser/safe_browsing/safe_browsing_store_sqlite.h" |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" | 9 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" |
| 10 #include "chrome/test/file_test_utils.h" | 10 #include "chrome/test/file_test_utils.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 const FilePath::CharType kFolderPrefix[] = | 16 const FilePath::CharType kFolderPrefix[] = |
| 17 FILE_PATH_LITERAL("SafeBrowsingTestStoreFile"); | 17 FILE_PATH_LITERAL("SafeBrowsingTestStoreFile"); |
| 18 | 18 |
| 19 class SafeBrowsingStoreFileTest : public PlatformTest { | 19 class SafeBrowsingStoreFileTest : public PlatformTest { |
| 20 public: | 20 public: |
| 21 virtual void SetUp() { | 21 virtual void SetUp() { |
| 22 PlatformTest::SetUp(); | 22 PlatformTest::SetUp(); |
| 23 | 23 |
| 24 FilePath temp_dir; | 24 FilePath temp_dir; |
| 25 ASSERT_TRUE(file_util::CreateNewTempDirectory(kFolderPrefix, &temp_dir)); | 25 ASSERT_TRUE(file_util::CreateNewTempDirectory(kFolderPrefix, &temp_dir)); |
| 26 | 26 |
| 27 file_deleter_.reset(new FileAutoDeleter(temp_dir)); | 27 file_deleter_.reset(new FileAutoDeleter(temp_dir)); |
| 28 | 28 |
| 29 filename_ = temp_dir; | 29 filename_ = temp_dir; |
| 30 filename_.AppendASCII("SafeBrowsingTestStore"); | 30 filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); |
| 31 file_util::Delete(filename_, false); | 31 file_util::Delete(filename_, false); |
| 32 | 32 |
| 33 // Make sure an old temporary file isn't hanging around. | 33 // Make sure an old temporary file isn't hanging around. |
| 34 const FilePath temp_file = | 34 const FilePath temp_file = |
| 35 SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); | 35 SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); |
| 36 file_util::Delete(temp_file, false); | 36 file_util::Delete(temp_file, false); |
| 37 | 37 |
| 38 store_.reset(new SafeBrowsingStoreFile()); | 38 store_.reset(new SafeBrowsingStoreFile()); |
| 39 store_->Init(filename_, NULL); | 39 store_->Init(filename_, NULL); |
| 40 } | 40 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 // At this point |filename_| references a SQLite store. | 279 // At this point |filename_| references a SQLite store. |
| 280 EXPECT_TRUE(file_util::PathExists(filename_)); | 280 EXPECT_TRUE(file_util::PathExists(filename_)); |
| 281 | 281 |
| 282 // Update and check using a file store. | 282 // Update and check using a file store. |
| 283 UpdateStore(store_.get()); | 283 UpdateStore(store_.get()); |
| 284 CheckStore(store_.get()); | 284 CheckStore(store_.get()); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace | 287 } // namespace |
| OLD | NEW |