Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/safe_browsing/database_manager.h" | 10 #include "chrome/browser/safe_browsing/database_manager.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 virtual SafeBrowsingService* CreateSafeBrowsingService() OVERRIDE { | 32 virtual SafeBrowsingService* CreateSafeBrowsingService() OVERRIDE { |
| 33 return new FakeSafeBrowsingService(); | 33 return new FakeSafeBrowsingService(); |
| 34 } | 34 } |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 class SafeBrowsingDatabaseManagerTest : public PlatformTest { | 39 class SafeBrowsingDatabaseManagerTest : public PlatformTest { |
| 40 public: | 40 public: |
| 41 | 41 |
| 42 virtual void SetUp() { | 42 virtual void SetUp() OVERRIDE { |
| 43 PlatformTest::SetUp(); | 43 PlatformTest::SetUp(); |
| 44 SafeBrowsingService::RegisterFactory(&factory_); | 44 SafeBrowsingService::RegisterFactory(&factory_); |
| 45 } | 45 } |
| 46 | |
| 47 virtual void TearDown() OVERRIDE { | |
| 48 SafeBrowsingService::RegisterFactory(NULL); | |
|
Scott Hess - ex-Googler
2013/10/31 22:07:20
PlatformTest::TearDown() after.
mattm
2013/10/31 22:39:23
Oops, Done.
| |
| 49 } | |
| 50 | |
| 46 bool RunSBHashTest(const safe_browsing_util::ListType list_type, | 51 bool RunSBHashTest(const safe_browsing_util::ListType list_type, |
| 47 const std::vector<SBThreatType>& expected_threats, | 52 const std::vector<SBThreatType>& expected_threats, |
| 48 const std::string& result_list); | 53 const std::string& result_list); |
| 49 | 54 |
| 50 private: | 55 private: |
| 51 TestBrowserThreadBundle thread_bundle_; | 56 TestBrowserThreadBundle thread_bundle_; |
| 52 TestSafeBrowsingServiceFactory factory_; | 57 TestSafeBrowsingServiceFactory factory_; |
| 53 }; | 58 }; |
| 54 | 59 |
| 55 bool SafeBrowsingDatabaseManagerTest::RunSBHashTest( | 60 bool SafeBrowsingDatabaseManagerTest::RunSBHashTest( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 std::vector<SBThreatType> multiple_threats; | 103 std::vector<SBThreatType> multiple_threats; |
| 99 multiple_threats.push_back(SB_THREAT_TYPE_URL_MALWARE); | 104 multiple_threats.push_back(SB_THREAT_TYPE_URL_MALWARE); |
| 100 multiple_threats.push_back(SB_THREAT_TYPE_URL_PHISHING); | 105 multiple_threats.push_back(SB_THREAT_TYPE_URL_PHISHING); |
| 101 EXPECT_FALSE(RunSBHashTest(safe_browsing_util::MALWARE, | 106 EXPECT_FALSE(RunSBHashTest(safe_browsing_util::MALWARE, |
| 102 multiple_threats, | 107 multiple_threats, |
| 103 safe_browsing_util::kBinUrlList)); | 108 safe_browsing_util::kBinUrlList)); |
| 104 EXPECT_TRUE(RunSBHashTest(safe_browsing_util::MALWARE, | 109 EXPECT_TRUE(RunSBHashTest(safe_browsing_util::MALWARE, |
| 105 multiple_threats, | 110 multiple_threats, |
| 106 safe_browsing_util::kMalwareList)); | 111 safe_browsing_util::kMalwareList)); |
| 107 } | 112 } |
| OLD | NEW |