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

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_host_unittest.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 csd_host_->OnSafeBrowsingHit(resource); 373 csd_host_->OnSafeBrowsingHit(resource);
374 ASSERT_TRUE(csd_host_->DidPageReceiveSafeBrowsingMatch()); 374 ASSERT_TRUE(csd_host_->DidPageReceiveSafeBrowsingMatch());
375 resource.callback.Reset(); 375 resource.callback.Reset();
376 ASSERT_TRUE(csd_host_->DidShowSBInterstitial()); 376 ASSERT_TRUE(csd_host_->DidShowSBInterstitial());
377 TestUnsafeResourceCopied(resource); 377 TestUnsafeResourceCopied(resource);
378 } 378 }
379 379
380 void NavigateWithSBHitAndCommit(const GURL& url) { 380 void NavigateWithSBHitAndCommit(const GURL& url) {
381 // Create a pending navigation. 381 // Create a pending navigation.
382 controller().LoadURL( 382 controller().LoadURL(
383 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 383 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
384 384
385 ASSERT_TRUE(pending_rvh()); 385 ASSERT_TRUE(pending_rvh());
386 if (web_contents()->GetRenderViewHost()->GetProcess()->GetID() == 386 if (web_contents()->GetRenderViewHost()->GetProcess()->GetID() ==
387 pending_rvh()->GetProcess()->GetID()) { 387 pending_rvh()->GetProcess()->GetID()) {
388 EXPECT_NE(web_contents()->GetRenderViewHost()->GetRoutingID(), 388 EXPECT_NE(web_contents()->GetRenderViewHost()->GetRoutingID(),
389 pending_rvh()->GetRoutingID()); 389 pending_rvh()->GetRoutingID());
390 } 390 }
391 391
392 // Simulate a safebrowsing hit before navigation completes. 392 // Simulate a safebrowsing hit before navigation completes.
393 UnsafeResource resource; 393 UnsafeResource resource;
(...skipping 14 matching lines...) Expand all
408 // a notification that it actually navigated. 408 // a notification that it actually navigated.
409 content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); 409 content::WebContentsTester::For(web_contents())->CommitPendingNavigation();
410 410
411 ASSERT_TRUE(csd_host_->DidPageReceiveSafeBrowsingMatch()); 411 ASSERT_TRUE(csd_host_->DidPageReceiveSafeBrowsingMatch());
412 ASSERT_TRUE(csd_host_->DidShowSBInterstitial()); 412 ASSERT_TRUE(csd_host_->DidShowSBInterstitial());
413 TestUnsafeResourceCopied(resource); 413 TestUnsafeResourceCopied(resource);
414 } 414 }
415 415
416 void NavigateWithoutSBHitAndCommit(const GURL& safe_url) { 416 void NavigateWithoutSBHitAndCommit(const GURL& safe_url) {
417 controller().LoadURL( 417 controller().LoadURL(
418 safe_url, content::Referrer(), content::PAGE_TRANSITION_LINK, 418 safe_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
419 std::string()); 419 std::string());
420 420
421 ASSERT_TRUE(pending_rvh()); 421 ASSERT_TRUE(pending_rvh());
422 if (web_contents()->GetRenderViewHost()->GetProcess()->GetID() == 422 if (web_contents()->GetRenderViewHost()->GetProcess()->GetID() ==
423 pending_rvh()->GetProcess()->GetID()) { 423 pending_rvh()->GetProcess()->GetID()) {
424 EXPECT_NE(web_contents()->GetRenderViewHost()->GetRoutingID(), 424 EXPECT_NE(web_contents()->GetRenderViewHost()->GetRoutingID(),
425 pending_rvh()->GetRoutingID()); 425 pending_rvh()->GetRoutingID());
426 } 426 }
427 ASSERT_FALSE(csd_host_->DidPageReceiveSafeBrowsingMatch()); 427 ASSERT_FALSE(csd_host_->DidPageReceiveSafeBrowsingMatch());
428 ASSERT_FALSE(csd_host_->DidShowSBInterstitial()); 428 ASSERT_FALSE(csd_host_->DidShowSBInterstitial());
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 EXPECT_EQ(url, resource.url); 1141 EXPECT_EQ(url, resource.url);
1142 EXPECT_EQ(url, resource.original_url); 1142 EXPECT_EQ(url, resource.original_url);
1143 1143
1144 ExpectStartPhishingDetection(NULL); 1144 ExpectStartPhishingDetection(NULL);
1145 1145
1146 // Showing a phishing warning will invalidate all the weak pointers which 1146 // Showing a phishing warning will invalidate all the weak pointers which
1147 // means we will not extract malware features. 1147 // means we will not extract malware features.
1148 ExpectShouldClassifyForMalwareResult(false); 1148 ExpectShouldClassifyForMalwareResult(false);
1149 } 1149 }
1150 } // namespace safe_browsing 1150 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698