OLD | NEW |
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 Loading... |
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 and release the | 173 // Delete the host object on the UI thread. |
174 // SafeBrowsingService. | |
175 BrowserThread::PostTask( | 174 BrowserThread::PostTask( |
176 BrowserThread::UI, | 175 BrowserThread::UI, |
177 FROM_HERE, | 176 FROM_HERE, |
178 new DeleteTask<ClientSideDetectionHost>(csd_host_.release())); | 177 new DeleteTask<ClientSideDetectionHost>(csd_host_.release())); |
179 sb_service_ = NULL; | |
180 message_loop_.RunAllPending(); | 178 message_loop_.RunAllPending(); |
181 TabContentsWrapperTestHarness::TearDown(); | 179 TabContentsWrapperTestHarness::TearDown(); |
182 io_thread_.reset(); | 180 io_thread_.reset(); |
183 ui_thread_.reset(); | 181 ui_thread_.reset(); |
184 } | 182 } |
185 | 183 |
186 void OnPhishingDetectionDone(const std::string& verdict_str) { | 184 void OnPhishingDetectionDone(const std::string& verdict_str) { |
187 csd_host_->OnPhishingDetectionDone(verdict_str); | 185 csd_host_->OnPhishingDetectionDone(verdict_str); |
188 } | 186 } |
189 | 187 |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); | 737 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); |
740 EXPECT_EQ(url, resource.url); | 738 EXPECT_EQ(url, resource.url); |
741 EXPECT_EQ(url, resource.original_url); | 739 EXPECT_EQ(url, resource.original_url); |
742 delete resource.client; | 740 delete resource.client; |
743 msg = process()->sink().GetFirstMessageMatching( | 741 msg = process()->sink().GetFirstMessageMatching( |
744 SafeBrowsingMsg_StartPhishingDetection::ID); | 742 SafeBrowsingMsg_StartPhishingDetection::ID); |
745 ASSERT_FALSE(msg); | 743 ASSERT_FALSE(msg); |
746 } | 744 } |
747 | 745 |
748 } // namespace safe_browsing | 746 } // namespace safe_browsing |
OLD | NEW |