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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void Disable(int) { 47 void Disable(int) {
48 // Ignore the status. 48 // Ignore the status.
49 SetEnabledAndRefreshState(false); 49 SetEnabledAndRefreshState(false);
50 } 50 }
51 51
52 private: 52 private:
53 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); 53 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService);
54 }; 54 };
55 55
56 ACTION(QuitCurrentMessageLoop) { 56 ACTION(QuitCurrentMessageLoop) {
57 MessageLoop::current()->Quit(); 57 base::MessageLoop::current()->Quit();
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 class ClientSideDetectionServiceTest : public testing::Test { 62 class ClientSideDetectionServiceTest : public testing::Test {
63 protected: 63 protected:
64 virtual void SetUp() { 64 virtual void SetUp() {
65 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE, 65 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE,
66 &msg_loop_)); 66 &msg_loop_));
67 67
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 ClientPhishingRequest* request) { 205 ClientPhishingRequest* request) {
206 ClientPhishingRequest_Feature* feature = 206 ClientPhishingRequest_Feature* feature =
207 request->add_non_model_feature_map(); 207 request->add_non_model_feature_map();
208 feature->set_name(name); 208 feature->set_name(name);
209 feature->set_value(value); 209 feature->set_value(value);
210 } 210 }
211 211
212 protected: 212 protected:
213 scoped_ptr<ClientSideDetectionService> csd_service_; 213 scoped_ptr<ClientSideDetectionService> csd_service_;
214 scoped_ptr<net::FakeURLFetcherFactory> factory_; 214 scoped_ptr<net::FakeURLFetcherFactory> factory_;
215 MessageLoop msg_loop_; 215 base::MessageLoop msg_loop_;
216 216
217 private: 217 private:
218 void SendRequestDone(GURL phishing_url, bool is_phishing) { 218 void SendRequestDone(GURL phishing_url, bool is_phishing) {
219 ASSERT_EQ(phishing_url, phishing_url_); 219 ASSERT_EQ(phishing_url, phishing_url_);
220 is_phishing_ = is_phishing; 220 is_phishing_ = is_phishing;
221 msg_loop_.Quit(); 221 msg_loop_.Quit();
222 } 222 }
223 223
224 void SendMalwareRequestDone(GURL url, bool is_malware) { 224 void SendMalwareRequestDone(GURL url, bool is_malware) {
225 ASSERT_EQ(phishing_url_, url); 225 ASSERT_EQ(phishing_url_, url);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 EXPECT_CALL(*service, ScheduleFetchModel(_)) 710 EXPECT_CALL(*service, ScheduleFetchModel(_))
711 .WillOnce(Invoke(service, &MockClientSideDetectionService::Schedule)); 711 .WillOnce(Invoke(service, &MockClientSideDetectionService::Schedule));
712 EXPECT_CALL(*service, EndFetchModel( 712 EXPECT_CALL(*service, EndFetchModel(
713 ClientSideDetectionService::MODEL_NOT_CHANGED)) 713 ClientSideDetectionService::MODEL_NOT_CHANGED))
714 .WillOnce(Invoke(service, &MockClientSideDetectionService::Disable)); 714 .WillOnce(Invoke(service, &MockClientSideDetectionService::Disable));
715 csd_service_->SetEnabledAndRefreshState(true); 715 csd_service_->SetEnabledAndRefreshState(true);
716 EXPECT_FALSE(SendClientReportPhishingRequest(GURL("http://a.com/"), 0.4f)); 716 EXPECT_FALSE(SendClientReportPhishingRequest(GURL("http://a.com/"), 0.4f));
717 Mock::VerifyAndClearExpectations(service); 717 Mock::VerifyAndClearExpectations(service);
718 } 718 }
719 } // namespace safe_browsing 719 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698