| OLD | NEW |
| 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/browser/prefs/pref_service.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
| 6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/safe_browsing/malware_details.h" | 7 #include "chrome/browser/safe_browsing/malware_details.h" |
| 8 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 8 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 contents()->GetRenderViewHost(), page_id, GURL(url), | 114 contents()->GetRenderViewHost(), page_id, GURL(url), |
| 115 content::PAGE_TRANSITION_TYPED); | 115 content::PAGE_TRANSITION_TYPED); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void GoBack(bool is_cross_site) { | 118 void GoBack(bool is_cross_site) { |
| 119 NavigationEntry* entry = contents()->GetController().GetEntryAtOffset(-1); | 119 NavigationEntry* entry = contents()->GetController().GetEntryAtOffset(-1); |
| 120 ASSERT_TRUE(entry); | 120 ASSERT_TRUE(entry); |
| 121 contents()->GetController().GoBack(); | 121 contents()->GetController().GoBack(); |
| 122 | 122 |
| 123 // The pending RVH should commit for cross-site navigations. | 123 // The pending RVH should commit for cross-site navigations. |
| 124 RenderViewHost* rvh = is_cross_site ? | 124 content::RenderViewHost* rvh = is_cross_site ? |
| 125 contents()->pending_rvh() : | 125 contents()->pending_rvh() : |
| 126 contents()->GetRenderViewHost(); | 126 contents()->GetRenderViewHost(); |
| 127 contents()->TestDidNavigate(rvh, entry->GetPageID(), GURL(entry->GetURL()), | 127 contents()->TestDidNavigate(rvh, entry->GetPageID(), GURL(entry->GetURL()), |
| 128 content::PAGE_TRANSITION_TYPED); | 128 content::PAGE_TRANSITION_TYPED); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void ShowInterstitial(bool is_subresource, const char* url) { | 131 void ShowInterstitial(bool is_subresource, const char* url) { |
| 132 SafeBrowsingService::UnsafeResource resource; | 132 SafeBrowsingService::UnsafeResource resource; |
| 133 InitResource(&resource, is_subresource, GURL(url)); | 133 InitResource(&resource, is_subresource, GURL(url)); |
| 134 SafeBrowsingBlockingPage::ShowBlockingPage(service_, resource); | 134 SafeBrowsingBlockingPage::ShowBlockingPage(service_, resource); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 619 |
| 620 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( | 620 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( |
| 621 prefs::kSafeBrowsingReportingEnabled)); | 621 prefs::kSafeBrowsingReportingEnabled)); |
| 622 | 622 |
| 623 // Simulate the user uncheck the report agreement checkbox. | 623 // Simulate the user uncheck the report agreement checkbox. |
| 624 sb_interstitial->SetReportingPreference(false); | 624 sb_interstitial->SetReportingPreference(false); |
| 625 | 625 |
| 626 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 626 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
| 627 prefs::kSafeBrowsingReportingEnabled)); | 627 prefs::kSafeBrowsingReportingEnabled)); |
| 628 } | 628 } |
| OLD | NEW |