| 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 <list> | 5 #include <list> |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 using content::NavigationEntry; | 23 using content::NavigationEntry; |
| 24 using content::WebContents; | 24 using content::WebContents; |
| 25 using content::WebContentsTester; | 25 using content::WebContentsTester; |
| 26 | 26 |
| 27 static const char* kGoogleURL = "http://www.google.com/"; | 27 static const char* kGoogleURL = "http://www.google.com/"; |
| 28 static const char* kGoodURL = "http://www.goodguys.com/"; | 28 static const char* kGoodURL = "http://www.goodguys.com/"; |
| 29 static const char* kBadURL = "http://www.badguys.com/"; | 29 static const char* kBadURL = "http://www.badguys.com/"; |
| 30 static const char* kBadURL2 = "http://www.badguys2.com/"; | 30 static const char* kBadURL2 = "http://www.badguys2.com/"; |
| 31 static const char* kBadURL3 = "http://www.badguys3.com/"; | 31 static const char* kBadURL3 = "http://www.badguys3.com/"; |
| 32 | 32 |
| 33 namespace { | 33 namespace safe_browsing { |
| 34 | 34 |
| 35 // A SafeBrowingBlockingPage class that does not create windows. | 35 // A SafeBrowingBlockingPage class that does not create windows. |
| 36 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { | 36 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { |
| 37 public: | 37 public: |
| 38 TestSafeBrowsingBlockingPage(SafeBrowsingUIManager* manager, | 38 TestSafeBrowsingBlockingPage(SafeBrowsingUIManager* manager, |
| 39 WebContents* web_contents, | 39 WebContents* web_contents, |
| 40 const UnsafeResourceList& unsafe_resources) | 40 const UnsafeResourceList& unsafe_resources) |
| 41 : SafeBrowsingBlockingPage(manager, web_contents, unsafe_resources) { | 41 : SafeBrowsingBlockingPage(manager, web_contents, unsafe_resources) { |
| 42 // Don't delay details at all for the unittest. | 42 // Don't delay details at all for the unittest. |
| 43 malware_details_proceed_delay_ms_ = 0; | 43 malware_details_proceed_delay_ms_ = 0; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 74 SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 74 SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
| 75 SafeBrowsingUIManager* manager, | 75 SafeBrowsingUIManager* manager, |
| 76 WebContents* web_contents, | 76 WebContents* web_contents, |
| 77 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) | 77 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) |
| 78 override { | 78 override { |
| 79 return new TestSafeBrowsingBlockingPage(manager, web_contents, | 79 return new TestSafeBrowsingBlockingPage(manager, web_contents, |
| 80 unsafe_resources); | 80 unsafe_resources); |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace | |
| 85 | |
| 86 class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness { | 84 class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness { |
| 87 public: | 85 public: |
| 88 // The decision the user made. | 86 // The decision the user made. |
| 89 enum UserResponse { | 87 enum UserResponse { |
| 90 PENDING, | 88 PENDING, |
| 91 OK, | 89 OK, |
| 92 CANCEL | 90 CANCEL |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 SafeBrowsingBlockingPageTest() { | 93 SafeBrowsingBlockingPageTest() { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 675 |
| 678 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( | 676 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( |
| 679 prefs::kSafeBrowsingExtendedReportingEnabled)); | 677 prefs::kSafeBrowsingExtendedReportingEnabled)); |
| 680 | 678 |
| 681 // Simulate the user uncheck the report agreement checkbox. | 679 // Simulate the user uncheck the report agreement checkbox. |
| 682 sb_interstitial->SetReportingPreference(false); | 680 sb_interstitial->SetReportingPreference(false); |
| 683 | 681 |
| 684 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( | 682 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( |
| 685 prefs::kSafeBrowsingExtendedReportingEnabled)); | 683 prefs::kSafeBrowsingExtendedReportingEnabled)); |
| 686 } | 684 } |
| 685 |
| 686 } // namespace safe_browsing |
| OLD | NEW |