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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_service_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "chrome/browser/extensions/api/dial/dial_device_data.h" 7 #include "chrome/browser/extensions/api/dial/dial_device_data.h"
8 #include "chrome/browser/extensions/api/dial/dial_service.h" 8 #include "chrome/browser/extensions/api/dial/dial_service.h"
9 #include "net/base/capturing_net_log.h" 9 #include "net/base/capturing_net_log.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 dial_service_.AddObserver(&mock_observer_); 46 dial_service_.AddObserver(&mock_observer_);
47 } 47 }
48 protected: 48 protected:
49 net::CapturingNetLog capturing_net_log_; 49 net::CapturingNetLog capturing_net_log_;
50 net::IPAddressNumber mock_ip_; 50 net::IPAddressNumber mock_ip_;
51 DialServiceImpl dial_service_; 51 DialServiceImpl dial_service_;
52 MockObserver mock_observer_; 52 MockObserver mock_observer_;
53 }; 53 };
54 54
55 TEST_F(DialServiceTest, TestSendMultipleRequests) { 55 TEST_F(DialServiceTest, TestSendMultipleRequests) {
56 MessageLoop loop(MessageLoop::TYPE_IO); 56 base::MessageLoop loop(base::MessageLoop::TYPE_IO);
57 // Setting the finish delay to zero disables the timer that invokes 57 // Setting the finish delay to zero disables the timer that invokes
58 // FinishDiscovery(). 58 // FinishDiscovery().
59 dial_service_.finish_delay_ = TimeDelta::FromSeconds(0); 59 dial_service_.finish_delay_ = TimeDelta::FromSeconds(0);
60 dial_service_.request_interval_ = TimeDelta::FromSeconds(0); 60 dial_service_.request_interval_ = TimeDelta::FromSeconds(0);
61 dial_service_.max_requests_ = 4; 61 dial_service_.max_requests_ = 4;
62 dial_service_.discovery_active_ = true; 62 dial_service_.discovery_active_ = true;
63 EXPECT_CALL(mock_observer_, OnDiscoveryRequest(A<DialService*>())).Times(4); 63 EXPECT_CALL(mock_observer_, OnDiscoveryRequest(A<DialService*>())).Times(4);
64 EXPECT_CALL(mock_observer_, OnDiscoveryFinished(A<DialService*>())).Times(1); 64 EXPECT_CALL(mock_observer_, OnDiscoveryFinished(A<DialService*>())).Times(1);
65 dial_service_.BindSocketAndSendRequest(mock_ip_); 65 dial_service_.BindSocketAndSendRequest(mock_ip_);
66 loop.RunUntilIdle(); 66 loop.RunUntilIdle();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 // Empty USN 151 // Empty USN
152 EXPECT_FALSE(DialServiceImpl::ParseResponse( 152 EXPECT_FALSE(DialServiceImpl::ParseResponse(
153 "HTTP/1.1 OK\r\n" 153 "HTTP/1.1 OK\r\n"
154 "LOCATION: http://127.0.0.1/dd.xml\r\n" 154 "LOCATION: http://127.0.0.1/dd.xml\r\n"
155 "USN:\r\n\r\n", 155 "USN:\r\n\r\n",
156 now, &not_parsed)); 156 now, &not_parsed));
157 } 157 }
158 158
159 } // namespace extensions 159 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_registry_unittest.cc ('k') | chrome/browser/extensions/api/downloads/downloads_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698