Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer_win_unittest.cc

Issue 856543004: Replace incident type handlers with implementations of Incident. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer_win_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer_win_unittest.cc
index 4e0faec10f086ce0e2052677dfa40f01e5c6040d..255117d31fb84361c22369f93fb0f189ca730098 100644
--- a/chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer_win_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer_win_unittest.cc
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/test/scoped_path_override.h"
+#include "chrome/browser/safe_browsing/incident_reporting/incident.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -44,15 +45,14 @@ class BinaryIntegrityAnalyzerWinTest : public ::testing::Test {
public:
BinaryIntegrityAnalyzerWinTest();
- void OnAddIncident(
- scoped_ptr<ClientIncidentReport_IncidentData> incident_data);
+ void OnAddIncident(scoped_ptr<Incident> incident);
protected:
bool callback_called_;
base::FilePath test_data_dir_;
base::ScopedTempDir temp_dir_;
scoped_ptr<base::ScopedPathOverride> exe_dir_override_;
- scoped_ptr<ClientIncidentReport_IncidentData> incident_data_;
+ scoped_ptr<Incident> incident_;
};
BinaryIntegrityAnalyzerWinTest::BinaryIntegrityAnalyzerWinTest()
@@ -72,11 +72,11 @@ BinaryIntegrityAnalyzerWinTest::BinaryIntegrityAnalyzerWinTest()
// Mock the AddIncidentCallback so we can test that VerifyBinaryIntegrity
// adds an incident callback when a signature verification fails.
void BinaryIntegrityAnalyzerWinTest::OnAddIncident(
- scoped_ptr<ClientIncidentReport_IncidentData> incident_data) {
+ scoped_ptr<Incident> incident) {
callback_called_ = true;
// Take ownership of the incident so that the text fixture can inspect it.
- incident_data_ = incident_data.Pass();
+ incident_ = incident.Pass();
}
TEST_F(BinaryIntegrityAnalyzerWinTest, GetCriticalBinariesPath) {
@@ -124,11 +124,13 @@ TEST_F(BinaryIntegrityAnalyzerWinTest, VerifyBinaryIntegrity) {
ASSERT_TRUE(callback_called_);
// Verify that the incident report contains the expected data.
- ASSERT_TRUE(incident_data_->has_binary_integrity());
- ASSERT_TRUE(incident_data_->binary_integrity().has_file_basename());
+ scoped_ptr<ClientIncidentReport_IncidentData> incident_data(
+ incident_->TakePayload());
+ ASSERT_TRUE(incident_data->has_binary_integrity());
+ ASSERT_TRUE(incident_data->binary_integrity().has_file_basename());
ASSERT_EQ("chrome_elf.dll",
- incident_data_->binary_integrity().file_basename());
- ASSERT_TRUE(incident_data_->binary_integrity().has_signature());
+ incident_data->binary_integrity().file_basename());
+ ASSERT_TRUE(incident_data->binary_integrity().has_signature());
}
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698