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

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

Issue 8345033: Collect some histograms about signed binary downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix chromeos and valgrind Created 9 years, 1 month 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" 9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" 10 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 csd_host_.reset(safe_browsing::ClientSideDetectionHost::Create( 163 csd_host_.reset(safe_browsing::ClientSideDetectionHost::Create(
164 contents_wrapper()->tab_contents())); 164 contents_wrapper()->tab_contents()));
165 csd_host_->set_client_side_detection_service(csd_service_.get()); 165 csd_host_->set_client_side_detection_service(csd_service_.get());
166 csd_host_->set_safe_browsing_service(sb_service_.get()); 166 csd_host_->set_safe_browsing_service(sb_service_.get());
167 // We need to create this here since we don't call 167 // We need to create this here since we don't call
168 // DidNavigateMainFramePostCommit in this test. 168 // DidNavigateMainFramePostCommit in this test.
169 csd_host_->browse_info_.reset(new BrowseInfo); 169 csd_host_->browse_info_.reset(new BrowseInfo);
170 } 170 }
171 171
172 virtual void TearDown() { 172 virtual void TearDown() {
173 // Delete the host object on the UI thread. 173 // Delete the host object on the UI thread and release the
174 // SafeBrowsingService.
174 BrowserThread::PostTask( 175 BrowserThread::PostTask(
175 BrowserThread::UI, 176 BrowserThread::UI,
176 FROM_HERE, 177 FROM_HERE,
177 new DeleteTask<ClientSideDetectionHost>(csd_host_.release())); 178 new DeleteTask<ClientSideDetectionHost>(csd_host_.release()));
179 sb_service_ = NULL;
178 message_loop_.RunAllPending(); 180 message_loop_.RunAllPending();
179 TabContentsWrapperTestHarness::TearDown(); 181 TabContentsWrapperTestHarness::TearDown();
180 io_thread_.reset(); 182 io_thread_.reset();
181 ui_thread_.reset(); 183 ui_thread_.reset();
182 } 184 }
183 185
184 void OnPhishingDetectionDone(const std::string& verdict_str) { 186 void OnPhishingDetectionDone(const std::string& verdict_str) {
185 csd_host_->OnPhishingDetectionDone(verdict_str); 187 csd_host_->OnPhishingDetectionDone(verdict_str);
186 } 188 }
187 189
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); 739 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get()));
738 EXPECT_EQ(url, resource.url); 740 EXPECT_EQ(url, resource.url);
739 EXPECT_EQ(url, resource.original_url); 741 EXPECT_EQ(url, resource.original_url);
740 delete resource.client; 742 delete resource.client;
741 msg = process()->sink().GetFirstMessageMatching( 743 msg = process()->sink().GetFirstMessageMatching(
742 SafeBrowsingMsg_StartPhishingDetection::ID); 744 SafeBrowsingMsg_StartPhishingDetection::ID);
743 ASSERT_FALSE(msg); 745 ASSERT_FALSE(msg);
744 } 746 }
745 747
746 } // namespace safe_browsing 748 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698