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

Side by Side Diff: chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc

Issue 2799093002: s/DidNavigateWithinPage/OnSameDocumentNavigation. (Closed)
Patch Set: Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/safe_browsing/phishing_classifier_delegate.h" 5 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/renderer/safe_browsing/features.h" 10 #include "chrome/renderer/safe_browsing/features.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 EXPECT_CALL(*classifier_, CancelPendingClassification()); 176 EXPECT_CALL(*classifier_, CancelPendingClassification());
177 PageCaptured(&page_text, false, url); 177 PageCaptured(&page_text, false, url);
178 Mock::VerifyAndClearExpectations(classifier_); 178 Mock::VerifyAndClearExpectations(classifier_);
179 179
180 OnStartPhishingDetection(url); 180 OnStartPhishingDetection(url);
181 page_text = ASCIIToUTF16("dummy"); 181 page_text = ASCIIToUTF16("dummy");
182 EXPECT_CALL(*classifier_, CancelPendingClassification()); 182 EXPECT_CALL(*classifier_, CancelPendingClassification());
183 PageCaptured(&page_text, false, url); 183 PageCaptured(&page_text, false, url);
184 Mock::VerifyAndClearExpectations(classifier_); 184 Mock::VerifyAndClearExpectations(classifier_);
185 185
186 // Navigating within page works similarly to a subframe navigation, but 186 // Same document navigation works similarly to a subframe navigation, but see
187 // see the TODO in PhishingClassifierDelegate::DidCommitProvisionalLoad. 187 // the TODO in PhishingClassifierDelegate::DidCommitProvisionalLoad.
188 EXPECT_CALL(*classifier_, CancelPendingClassification()); 188 EXPECT_CALL(*classifier_, CancelPendingClassification());
189 DidNavigateWithinPage(GetMainFrame(), true, true); 189 OnSameDocumentNavigation(GetMainFrame(), true, true);
190 Mock::VerifyAndClearExpectations(classifier_); 190 Mock::VerifyAndClearExpectations(classifier_);
191 191
192 OnStartPhishingDetection(url); 192 OnStartPhishingDetection(url);
193 page_text = ASCIIToUTF16("dummy"); 193 page_text = ASCIIToUTF16("dummy");
194 EXPECT_CALL(*classifier_, CancelPendingClassification()); 194 EXPECT_CALL(*classifier_, CancelPendingClassification());
195 PageCaptured(&page_text, false, url); 195 PageCaptured(&page_text, false, url);
196 Mock::VerifyAndClearExpectations(classifier_); 196 Mock::VerifyAndClearExpectations(classifier_);
197 197
198 // Now load a new toplevel page, which should trigger another classification. 198 // Now load a new toplevel page, which should trigger another classification.
199 EXPECT_CALL(*classifier_, CancelPendingClassification()); 199 EXPECT_CALL(*classifier_, CancelPendingClassification());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 SimulatePageTrantitionForwardOrBack(html.c_str(), url.spec().c_str()); 243 SimulatePageTrantitionForwardOrBack(html.c_str(), url.spec().c_str());
244 Mock::VerifyAndClearExpectations(classifier_); 244 Mock::VerifyAndClearExpectations(classifier_);
245 245
246 page_text = ASCIIToUTF16("dummy"); 246 page_text = ASCIIToUTF16("dummy");
247 OnStartPhishingDetection(url); 247 OnStartPhishingDetection(url);
248 EXPECT_CALL(*classifier_, CancelPendingClassification()); 248 EXPECT_CALL(*classifier_, CancelPendingClassification());
249 PageCaptured(&page_text, false, url); 249 PageCaptured(&page_text, false, url);
250 Mock::VerifyAndClearExpectations(classifier_); 250 Mock::VerifyAndClearExpectations(classifier_);
251 251
252 EXPECT_CALL(*classifier_, CancelPendingClassification()); 252 EXPECT_CALL(*classifier_, CancelPendingClassification());
253 // In-page navigation. 253 // Same document navigation.
254 DidNavigateWithinPage(GetMainFrame(), true, true); 254 OnSameDocumentNavigation(GetMainFrame(), true, true);
255 Mock::VerifyAndClearExpectations(classifier_); 255 Mock::VerifyAndClearExpectations(classifier_);
256 256
257 OnStartPhishingDetection(url); 257 OnStartPhishingDetection(url);
258 page_text = ASCIIToUTF16("dummy"); 258 page_text = ASCIIToUTF16("dummy");
259 EXPECT_CALL(*classifier_, CancelPendingClassification()); 259 EXPECT_CALL(*classifier_, CancelPendingClassification());
260 PageCaptured(&page_text, false, url); 260 PageCaptured(&page_text, false, url);
261 Mock::VerifyAndClearExpectations(classifier_); 261 Mock::VerifyAndClearExpectations(classifier_);
262 262
263 // The delegate will cancel pending classification on destruction. 263 // The delegate will cancel pending classification on destruction.
264 EXPECT_CALL(*classifier_, CancelPendingClassification()); 264 EXPECT_CALL(*classifier_, CancelPendingClassification());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 verdict.set_url(url.spec()); 496 verdict.set_url(url.spec());
497 verdict.set_client_score(0.8f); 497 verdict.set_client_score(0.8f);
498 verdict.set_is_phishing(false); // Send IPC even if site is not phishing. 498 verdict.set_is_phishing(false); // Send IPC even if site is not phishing.
499 RunAndVerifyClassificationDone(verdict); 499 RunAndVerifyClassificationDone(verdict);
500 500
501 // The delegate will cancel pending classification on destruction. 501 // The delegate will cancel pending classification on destruction.
502 EXPECT_CALL(*classifier_, CancelPendingClassification()); 502 EXPECT_CALL(*classifier_, CancelPendingClassification());
503 } 503 }
504 504
505 } // namespace safe_browsing 505 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer_browsertest.cc ('k') | content/public/test/render_view_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698