| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/safe_browsing/unverified_download_policy.h" | 5 #include "chrome/browser/safe_browsing/unverified_download_policy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 browser_process->safe_browsing_service()->ShutDown(); | 117 browser_process->safe_browsing_service()->ShutDown(); |
| 118 browser_process->SetSafeBrowsingService(nullptr); | 118 browser_process->SetSafeBrowsingService(nullptr); |
| 119 testing_safe_browsing_service_ = nullptr; | 119 testing_safe_browsing_service_ = nullptr; |
| 120 SafeBrowsingService::RegisterFactory(nullptr); | 120 SafeBrowsingService::RegisterFactory(nullptr); |
| 121 base::RunLoop().RunUntilIdle(); | 121 base::RunLoop().RunUntilIdle(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 protected: | 124 protected: |
| 125 content::TestBrowserThreadBundle thread_bundle_; | 125 content::TestBrowserThreadBundle thread_bundle_; |
| 126 TestSafeBrowsingServiceFactory test_safe_browsing_service_factory_; | 126 TestSafeBrowsingServiceFactory test_safe_browsing_service_factory_; |
| 127 scoped_ptr<TestingProfileManager> testing_profile_manager_; | 127 std::unique_ptr<TestingProfileManager> testing_profile_manager_; |
| 128 scoped_refptr<SafeBrowsingService> testing_safe_browsing_service_; | 128 scoped_refptr<SafeBrowsingService> testing_safe_browsing_service_; |
| 129 TestingProfile* testing_profile_ = nullptr; | 129 TestingProfile* testing_profile_ = nullptr; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 // Verify that SafeBrowsing whitelists can override field trials. | 134 // Verify that SafeBrowsing whitelists can override field trials. |
| 135 TEST_F(UnverifiedDownloadPolicyTest, Whitelist) { | 135 TEST_F(UnverifiedDownloadPolicyTest, Whitelist) { |
| 136 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 136 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 137 switches::kDisallowUncheckedDangerousDownloads); | 137 switches::kDisallowUncheckedDangerousDownloads); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 219 |
| 220 CompletionCallback completion_callback; | 220 CompletionCallback completion_callback; |
| 221 CheckUnverifiedDownloadPolicy(GURL("http://supported.example.com/foo/bar"), | 221 CheckUnverifiedDownloadPolicy(GURL("http://supported.example.com/foo/bar"), |
| 222 test_file_path, test_extensions, | 222 test_file_path, test_extensions, |
| 223 completion_callback.GetCallback()); | 223 completion_callback.GetCallback()); |
| 224 EXPECT_EQ(UnverifiedDownloadPolicy::ALLOWED, | 224 EXPECT_EQ(UnverifiedDownloadPolicy::ALLOWED, |
| 225 completion_callback.WaitForResult()); | 225 completion_callback.WaitForResult()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace safe_browsing | 228 } // namespace safe_browsing |
| OLD | NEW |