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

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

Issue 9310020: Add SafeBrowsingURLRequestContext which stores cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes, fix DownloadProtectionServiceTest Created 8 years, 10 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 | 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 #include "chrome/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 virtual void SetUp() { 125 virtual void SetUp() {
126 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, 126 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI,
127 &msg_loop_)); 127 &msg_loop_));
128 // Start real threads for the IO and File threads so that the DCHECKs 128 // Start real threads for the IO and File threads so that the DCHECKs
129 // to test that we're on the correct thread work. 129 // to test that we're on the correct thread work.
130 io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO)); 130 io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO));
131 ASSERT_TRUE(io_thread_->Start()); 131 ASSERT_TRUE(io_thread_->Start());
132 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE)); 132 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE));
133 ASSERT_TRUE(file_thread_->Start()); 133 ASSERT_TRUE(file_thread_->Start());
134 sb_service_ = new StrictMock<MockSafeBrowsingService>(); 134 sb_service_ = new StrictMock<MockSafeBrowsingService>();
135 sb_service_->Initialize();
135 signature_util_ = new StrictMock<MockSignatureUtil>(); 136 signature_util_ = new StrictMock<MockSignatureUtil>();
136 download_service_ = sb_service_->download_protection_service(); 137 download_service_ = sb_service_->download_protection_service();
137 download_service_->signature_util_ = signature_util_; 138 download_service_->signature_util_ = signature_util_;
138 download_service_->SetEnabled(true); 139 download_service_->SetEnabled(true);
139 msg_loop_.RunAllPending(); 140 msg_loop_.RunAllPending();
140 141
141 FilePath source_path; 142 FilePath source_path;
142 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path)); 143 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path));
143 testdata_path_ = source_path 144 testdata_path_ = source_path
144 .AppendASCII("chrome") 145 .AppendASCII("chrome")
145 .AppendASCII("test") 146 .AppendASCII("test")
146 .AppendASCII("data") 147 .AppendASCII("data")
147 .AppendASCII("safe_browsing") 148 .AppendASCII("safe_browsing")
148 .AppendASCII("download_protection"); 149 .AppendASCII("download_protection");
149 } 150 }
150 151
151 virtual void TearDown() { 152 virtual void TearDown() {
153 sb_service_->ShutDown();
152 // Flush all of the thread message loops to ensure that there are no 154 // Flush all of the thread message loops to ensure that there are no
153 // tasks currently running. 155 // tasks currently running.
154 FlushThreadMessageLoops(); 156 FlushThreadMessageLoops();
155 sb_service_ = NULL; 157 sb_service_ = NULL;
156 io_thread_.reset(); 158 io_thread_.reset();
157 file_thread_.reset(); 159 file_thread_.reset();
158 ui_thread_.reset(); 160 ui_thread_.reset();
159 } 161 }
160 162
161 bool RequestContainsResource(const ClientDownloadRequest& request, 163 bool RequestContainsResource(const ClientDownloadRequest& request,
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); 849 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings);
848 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); 850 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit"));
849 851
850 cert = ReadTestCertificate("test_c.pem"); 852 cert = ReadTestCertificate("test_c.pem");
851 ASSERT_TRUE(cert.get()); 853 ASSERT_TRUE(cert.get());
852 whitelist_strings.clear(); 854 whitelist_strings.clear();
853 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); 855 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings);
854 EXPECT_THAT(whitelist_strings, ElementsAre()); 856 EXPECT_THAT(whitelist_strings, ElementsAre());
855 } 857 }
856 } // namespace safe_browsing 858 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698