Commit b98eff50 authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Add test for population of visual features in PhishGuard pings

To ensure the data is populated for SBER users, but not regular users,
add a unit test.

Bug: 922226
Change-Id: Ia8af7e347bcfe546d8f3af5d5c53aa8067d4a3ee
Reviewed-on: https://chromium-review.googlesource.com/c/1495367
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636905}
parent b610970f
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using testing::_; using testing::_;
using testing::AnyNumber;
using testing::ElementsAre; using testing::ElementsAre;
using testing::Return; using testing::Return;
using PasswordReuseEvent = using PasswordReuseEvent =
...@@ -1335,6 +1336,30 @@ TEST_P(PasswordProtectionServiceTest, TestPingsForAboutBlank) { ...@@ -1335,6 +1336,30 @@ TEST_P(PasswordProtectionServiceTest, TestPingsForAboutBlank) {
histograms_.ExpectTotalCount(kPasswordOnFocusRequestOutcomeHistogram, 1); histograms_.ExpectTotalCount(kPasswordOnFocusRequestOutcomeHistogram, 1);
} }
TEST_P(PasswordProtectionServiceTest,
TestVisualFeaturesPopulatedInOnFocusPing) {
LoginReputationClientResponse expected_response =
CreateVerdictProto(LoginReputationClientResponse::PHISHING, 10 * kMinute,
GURL("about:blank").host());
test_url_loader_factory_.AddResponse(url_.spec(),
expected_response.SerializeAsString());
EXPECT_CALL(*password_protection_service_, GetCurrentContentAreaSize())
.Times(AnyNumber())
.WillOnce(Return(gfx::Size(1000, 1000)));
password_protection_service_->StartRequest(
GetWebContents(), GURL("about:blank"), GURL(), GURL(),
PasswordReuseEvent::SAVED_PASSWORD, {"example.com"},
LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, true);
base::RunLoop().RunUntilIdle();
bool is_sber = GetParam();
if (is_sber) {
ASSERT_NE(nullptr, password_protection_service_->GetLatestRequestProto());
EXPECT_TRUE(password_protection_service_->GetLatestRequestProto()
->has_visual_features());
}
}
INSTANTIATE_TEST_SUITE_P(Regular, INSTANTIATE_TEST_SUITE_P(Regular,
PasswordProtectionServiceTest, PasswordProtectionServiceTest,
::testing::Values(false)); ::testing::Values(false));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment