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

Side by Side Diff: components/safe_browsing/password_protection/password_protection_service_unittest.cc

Issue 2905343002: Show interstitial on a password on focus ping with PHISHING verdict. (Closed)
Patch Set: nit Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "components/safe_browsing/password_protection/password_protection_servi ce.h" 4 #include "components/safe_browsing/password_protection/password_protection_servi ce.h"
5 5
6 #include "base/memory/ptr_util.h" 6 #include "base/memory/ptr_util.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 : PasswordProtectionService(database_manager, 71 : PasswordProtectionService(database_manager,
72 request_context_getter, 72 request_context_getter,
73 nullptr, 73 nullptr,
74 content_setting_map.get()), 74 content_setting_map.get()),
75 is_extended_reporting_(true), 75 is_extended_reporting_(true),
76 is_incognito_(false), 76 is_incognito_(false),
77 latest_request_(nullptr) {} 77 latest_request_(nullptr) {}
78 78
79 void RequestFinished( 79 void RequestFinished(
80 PasswordProtectionRequest* request, 80 PasswordProtectionRequest* request,
81 bool already_cached_unused,
81 std::unique_ptr<LoginReputationClientResponse> response) override { 82 std::unique_ptr<LoginReputationClientResponse> response) override {
82 latest_request_ = request; 83 latest_request_ = request;
83 latest_response_ = std::move(response); 84 latest_response_ = std::move(response);
84 } 85 }
85 86
86 // Since referrer chain logic has been thoroughly tested in 87 // Since referrer chain logic has been thoroughly tested in
87 // SBNavigationObserverBrowserTest class, we intentionally leave this function 88 // SBNavigationObserverBrowserTest class, we intentionally leave this function
88 // as a no-op here. 89 // as a no-op here.
89 void FillReferrerChain(const GURL& event_url, 90 void FillReferrerChain(const GURL& event_url,
90 int event_tab_id, 91 int event_tab_id,
91 LoginReputationClientRequest::Frame* frame) override {} 92 LoginReputationClientRequest::Frame* frame) override {}
92 93
93 bool IsExtendedReporting() override { return is_extended_reporting_; } 94 bool IsExtendedReporting() override { return is_extended_reporting_; }
94 95
95 bool IsIncognito() override { return is_incognito_; } 96 bool IsIncognito() override { return is_incognito_; }
96 97
97 void set_extended_reporting(bool enabled) { 98 void set_extended_reporting(bool enabled) {
98 is_extended_reporting_ = enabled; 99 is_extended_reporting_ = enabled;
99 } 100 }
100 101
101 void set_incognito(bool enabled) { is_incognito_ = enabled; } 102 void set_incognito(bool enabled) { is_incognito_ = enabled; }
102 103
103 bool IsPingingEnabled(const base::Feature& feature, 104 bool IsPingingEnabled(const base::Feature& feature,
104 RequestOutcome* reason) override { 105 RequestOutcome* reason) override {
105 return true; 106 return true;
106 } 107 }
107 108
109 void ShowPhishingInterstitial(const GURL& phishing_url,
110 const std::string& token,
111 content::WebContents* web_contents) override {}
112
108 bool IsHistorySyncEnabled() override { return false; } 113 bool IsHistorySyncEnabled() override { return false; }
109 114
110 LoginReputationClientResponse* latest_response() { 115 LoginReputationClientResponse* latest_response() {
111 return latest_response_.get(); 116 return latest_response_.get();
112 } 117 }
113 118
114 ~TestPasswordProtectionService() override {} 119 ~TestPasswordProtectionService() override {}
115 120
116 size_t GetPendingRequestsCount() { return requests_.size(); } 121 size_t GetPendingRequestsCount() { return requests_.size(); }
117 122
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 EXPECT_EQ(kTargetUrl, actual_request->page_url()); 648 EXPECT_EQ(kTargetUrl, actual_request->page_url());
644 EXPECT_EQ(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, 649 EXPECT_EQ(LoginReputationClientRequest::PASSWORD_REUSE_EVENT,
645 actual_request->trigger_type()); 650 actual_request->trigger_type());
646 EXPECT_EQ(1, actual_request->frames_size()); 651 EXPECT_EQ(1, actual_request->frames_size());
647 EXPECT_EQ(kTargetUrl, actual_request->frames(0).url()); 652 EXPECT_EQ(kTargetUrl, actual_request->frames(0).url());
648 // TODO(jialiul): Update this test when we're ready to fill more fields. 653 // TODO(jialiul): Update this test when we're ready to fill more fields.
649 ASSERT_FALSE(actual_request->has_password_reuse_event()); 654 ASSERT_FALSE(actual_request->has_password_reuse_event());
650 } 655 }
651 656
652 } // namespace safe_browsing 657 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698