Chromium Code Reviews| 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 "chrome/browser/safe_browsing/incident_reporting/module_load_analyzer.h " | 5 #include "chrome/browser/safe_browsing/incident_reporting/module_load_analyzer.h " |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 | 35 |
| 36 const char kNonWhitelistedModuleName[] = "blacklist_test_dll_1.dll"; | 36 const char kNonWhitelistedModuleName[] = "blacklist_test_dll_1.dll"; |
| 37 | 37 |
| 38 class MockSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager { | 38 class MockSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager { |
| 39 public: | 39 public: |
| 40 MockSafeBrowsingDatabaseManager() {} | 40 MockSafeBrowsingDatabaseManager() {} |
| 41 | 41 |
| 42 MOCK_METHOD1(MatchModuleWhitelistString, bool(const std::string&)); | 42 MOCK_METHOD1(MatchModuleWhitelistString, bool(const std::string&)); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 virtual ~MockSafeBrowsingDatabaseManager() override {} | |
|
Nico
2016/02/25 21:11:28
remove virtual, else the style plugin will complai
| |
| 46 | |
| 45 DISALLOW_COPY_AND_ASSIGN(MockSafeBrowsingDatabaseManager); | 47 DISALLOW_COPY_AND_ASSIGN(MockSafeBrowsingDatabaseManager); |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 class ModuleLoadAnalayzerTest : public testing::Test { | 50 class ModuleLoadAnalayzerTest : public testing::Test { |
| 49 protected: | 51 protected: |
| 50 ModuleLoadAnalayzerTest() | 52 ModuleLoadAnalayzerTest() |
| 51 : mock_incident_receiver_( | 53 : mock_incident_receiver_( |
| 52 new StrictMock<safe_browsing::MockIncidentReceiver>()), | 54 new StrictMock<safe_browsing::MockIncidentReceiver>()), |
| 53 mock_safe_browsing_database_manager_( | 55 mock_safe_browsing_database_manager_( |
| 54 new MockSafeBrowsingDatabaseManager()) { | 56 new MockSafeBrowsingDatabaseManager()) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 | 114 |
| 113 TEST_F(ModuleLoadAnalayzerTest, TestNonWhitelistedDLLs) { | 115 TEST_F(ModuleLoadAnalayzerTest, TestNonWhitelistedDLLs) { |
| 114 EXPECT_CALL(*mock_safe_browsing_database_manager_, | 116 EXPECT_CALL(*mock_safe_browsing_database_manager_, |
| 115 MatchModuleWhitelistString(kNonWhitelistedModuleName)) | 117 MatchModuleWhitelistString(kNonWhitelistedModuleName)) |
| 116 .WillOnce(Return(false)); | 118 .WillOnce(Return(false)); |
| 117 | 119 |
| 118 ExpectIncident(kNonWhitelistedModuleName); | 120 ExpectIncident(kNonWhitelistedModuleName); |
| 119 } | 121 } |
| 120 | 122 |
| 121 } // namespace safe_browsing | 123 } // namespace safe_browsing |
| OLD | NEW |