OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.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 base::FilePath::CharType kFolderPrefix[] = | |
17 FILE_PATH_LITERAL("SafeBrowsingTestStoreFile"); | |
18 | |
19 class SafeBrowsingStoreFileTest : public PlatformTest { | 16 class SafeBrowsingStoreFileTest : public PlatformTest { |
20 public: | 17 public: |
21 virtual void SetUp() { | 18 virtual void SetUp() { |
22 PlatformTest::SetUp(); | 19 PlatformTest::SetUp(); |
23 | 20 |
24 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 21 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
25 | 22 |
26 filename_ = temp_dir_.path(); | 23 filename_ = temp_dir_.path(); |
27 filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); | 24 filename_ = filename_.AppendASCII("SafeBrowsingTestStore"); |
28 | 25 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 EXPECT_GE(fputs("hello", file.get()), 0); | 184 EXPECT_GE(fputs("hello", file.get()), 0); |
188 } | 185 } |
189 ASSERT_TRUE(store_->BeginUpdate()); | 186 ASSERT_TRUE(store_->BeginUpdate()); |
190 EXPECT_FALSE(corruption_detected_); | 187 EXPECT_FALSE(corruption_detected_); |
191 EXPECT_FALSE(store_->CheckValidity()); | 188 EXPECT_FALSE(store_->CheckValidity()); |
192 EXPECT_TRUE(corruption_detected_); | 189 EXPECT_TRUE(corruption_detected_); |
193 EXPECT_TRUE(store_->CancelUpdate()); | 190 EXPECT_TRUE(store_->CancelUpdate()); |
194 } | 191 } |
195 | 192 |
196 } // namespace | 193 } // namespace |
OLD | NEW |