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

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

Issue 9015021: Remove DeleteTask and convert remaining users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix last Linux gotchas (upload attempt #2) Created 8 years, 11 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 "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"
9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" 8 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" 9 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
11 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 10 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 11 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
14 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" 13 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h"
15 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/safe_browsing/csd.pb.h" 15 #include "chrome/common/safe_browsing/csd.pb.h"
17 #include "chrome/common/safe_browsing/safebrowsing_messages.h" 16 #include "chrome/common/safe_browsing/safebrowsing_messages.h"
18 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 csd_host_->set_client_side_detection_service(csd_service_.get()); 170 csd_host_->set_client_side_detection_service(csd_service_.get());
172 csd_host_->set_safe_browsing_service(sb_service_.get()); 171 csd_host_->set_safe_browsing_service(sb_service_.get());
173 // We need to create this here since we don't call 172 // We need to create this here since we don't call
174 // DidNavigateMainFramePostCommit in this test. 173 // DidNavigateMainFramePostCommit in this test.
175 csd_host_->browse_info_.reset(new BrowseInfo); 174 csd_host_->browse_info_.reset(new BrowseInfo);
176 } 175 }
177 176
178 virtual void TearDown() { 177 virtual void TearDown() {
179 // Delete the host object on the UI thread and release the 178 // Delete the host object on the UI thread and release the
180 // SafeBrowsingService. 179 // SafeBrowsingService.
181 BrowserThread::PostTask( 180 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE,
182 BrowserThread::UI, 181 csd_host_.release());
183 FROM_HERE,
184 new DeleteTask<ClientSideDetectionHost>(csd_host_.release()));
185 sb_service_ = NULL; 182 sb_service_ = NULL;
186 message_loop_.RunAllPending(); 183 message_loop_.RunAllPending();
187 TabContentsWrapperTestHarness::TearDown(); 184 TabContentsWrapperTestHarness::TearDown();
188 io_thread_.reset(); 185 io_thread_.reset();
189 ui_thread_.reset(); 186 ui_thread_.reset();
190 } 187 }
191 188
192 void OnPhishingDetectionDone(const std::string& verdict_str) { 189 void OnPhishingDetectionDone(const std::string& verdict_str) {
193 csd_host_->OnPhishingDetectionDone(verdict_str); 190 csd_host_->OnPhishingDetectionDone(verdict_str);
194 } 191 }
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); 734 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get()));
738 EXPECT_EQ(url, resource.url); 735 EXPECT_EQ(url, resource.url);
739 EXPECT_EQ(url, resource.original_url); 736 EXPECT_EQ(url, resource.original_url);
740 delete resource.client; 737 delete resource.client;
741 msg = process()->sink().GetFirstMessageMatching( 738 msg = process()->sink().GetFirstMessageMatching(
742 SafeBrowsingMsg_StartPhishingDetection::ID); 739 SafeBrowsingMsg_StartPhishingDetection::ID);
743 ASSERT_FALSE(msg); 740 ASSERT_FALSE(msg);
744 } 741 }
745 742
746 } // namespace safe_browsing 743 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698