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

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

Issue 8801003: Make TestTabContents::TestDidNavigate not take a ViewHostMsg_FrameNavigate_Params, since that's a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Remove the accidental commenting out that I had done before last commit Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 5
6 #include "chrome/browser/prefs/pref_service.h" 6 #include "chrome/browser/prefs/pref_service.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/safe_browsing/malware_details.h" 8 #include "chrome/browser/safe_browsing/malware_details.h"
9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 11 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
12 #include "content/browser/tab_contents/navigation_entry.h" 12 #include "content/browser/tab_contents/navigation_entry.h"
13 #include "content/browser/tab_contents/test_tab_contents.h" 13 #include "content/browser/tab_contents/test_tab_contents.h"
14 #include "content/common/view_messages.h"
15 #include "content/test/test_browser_thread.h" 14 #include "content/test/test_browser_thread.h"
16 15
17 using content::BrowserThread; 16 using content::BrowserThread;
18 17
19 static const char* kGoogleURL = "http://www.google.com/"; 18 static const char* kGoogleURL = "http://www.google.com/";
20 static const char* kGoodURL = "http://www.goodguys.com/"; 19 static const char* kGoodURL = "http://www.goodguys.com/";
21 static const char* kBadURL = "http://www.badguys.com/"; 20 static const char* kBadURL = "http://www.badguys.com/";
22 static const char* kBadURL2 = "http://www.badguys2.com/"; 21 static const char* kBadURL2 = "http://www.badguys2.com/";
23 static const char* kBadURL3 = "http://www.badguys3.com/"; 22 static const char* kBadURL3 = "http://www.badguys3.com/";
24 23
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 SafeBrowsingService::UrlCheckResult result) { 102 SafeBrowsingService::UrlCheckResult result) {
104 } 103 }
105 virtual void OnBlockingPageComplete(bool proceed) { 104 virtual void OnBlockingPageComplete(bool proceed) {
106 if (proceed) 105 if (proceed)
107 user_response_ = OK; 106 user_response_ = OK;
108 else 107 else
109 user_response_ = CANCEL; 108 user_response_ = CANCEL;
110 } 109 }
111 110
112 void Navigate(const char* url, int page_id) { 111 void Navigate(const char* url, int page_id) {
113 ViewHostMsg_FrameNavigate_Params params; 112 contents()->TestDidNavigate(
114 InitNavigateParams( 113 contents()->render_view_host(), page_id, GURL(url),
115 &params, page_id, GURL(url), content::PAGE_TRANSITION_TYPED); 114 content::PAGE_TRANSITION_TYPED);
116 contents()->TestDidNavigate(contents()->render_view_host(), params);
117 } 115 }
118 116
119 void GoBackCrossSite() { 117 void GoBackCrossSite() {
120 NavigationEntry* entry = contents()->controller().GetEntryAtOffset(-1); 118 NavigationEntry* entry = contents()->controller().GetEntryAtOffset(-1);
121 ASSERT_TRUE(entry); 119 ASSERT_TRUE(entry);
122 contents()->controller().GoBack(); 120 contents()->controller().GoBack();
123 121
124 // The navigation should commit in the pending RVH. 122 // The navigation should commit in the pending RVH.
125 ViewHostMsg_FrameNavigate_Params params; 123 contents()->TestDidNavigate(
126 InitNavigateParams(&params, entry->page_id(), GURL(entry->url()), 124 contents()->pending_rvh(), entry->page_id(), GURL(entry->url()),
127 content::PAGE_TRANSITION_TYPED); 125 content::PAGE_TRANSITION_TYPED);
128 contents()->TestDidNavigate(contents()->pending_rvh(), params);
129 } 126 }
130 127
131 void ShowInterstitial(bool is_subresource, const char* url) { 128 void ShowInterstitial(bool is_subresource, const char* url) {
132 SafeBrowsingService::UnsafeResource resource; 129 SafeBrowsingService::UnsafeResource resource;
133 InitResource(&resource, is_subresource, GURL(url)); 130 InitResource(&resource, is_subresource, GURL(url));
134 SafeBrowsingBlockingPage::ShowBlockingPage(service_, resource); 131 SafeBrowsingBlockingPage::ShowBlockingPage(service_, resource);
135 } 132 }
136 133
137 // Returns the SafeBrowsingBlockingPage currently showing or NULL if none is 134 // Returns the SafeBrowsingBlockingPage currently showing or NULL if none is
138 // showing. 135 // showing.
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 592
596 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( 593 EXPECT_TRUE(profile->GetPrefs()->GetBoolean(
597 prefs::kSafeBrowsingReportingEnabled)); 594 prefs::kSafeBrowsingReportingEnabled));
598 595
599 // Simulate the user uncheck the report agreement checkbox. 596 // Simulate the user uncheck the report agreement checkbox.
600 sb_interstitial->SetReportingPreference(false); 597 sb_interstitial->SetReportingPreference(false);
601 598
602 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( 599 EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
603 prefs::kSafeBrowsingReportingEnabled)); 600 prefs::kSafeBrowsingReportingEnabled));
604 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698