OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" | 6 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" |
7 #include "chrome/browser/local_discovery/test_service_discovery_client.h" | 7 #include "chrome/browser/local_discovery/test_service_discovery_client.h" |
8 #include "net/url_request/test_url_fetcher_factory.h" | 8 #include "net/url_request/test_url_fetcher_factory.h" |
9 #include "net/url_request/url_request_test_util.h" | 9 #include "net/url_request/url_request_test_util.h" |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 fetcher->delegate()->OnURLFetchComplete(fetcher); | 134 fetcher->delegate()->OnURLFetchComplete(fetcher); |
135 return true; | 135 return true; |
136 } | 136 } |
137 | 137 |
138 void SimulateReceive(const uint8* packet, size_t size) { | 138 void SimulateReceive(const uint8* packet, size_t size) { |
139 test_service_discovery_client_->SimulateReceive(packet, size); | 139 test_service_discovery_client_->SimulateReceive(packet, size); |
140 message_loop_.RunUntilIdle(); | 140 message_loop_.RunUntilIdle(); |
141 } | 141 } |
142 | 142 |
143 void ExpectAnyPacket() { | 143 void ExpectAnyPacket() { |
144 EXPECT_CALL(*test_service_discovery_client_, OnSendTo(_)).Times(AtLeast(2)); | 144 EXPECT_CALL(*test_service_discovery_client_.get(), OnSendTo(_)) |
| 145 .Times(AtLeast(2)); |
145 } | 146 } |
146 | 147 |
147 protected: | 148 protected: |
148 base::MessageLoop message_loop_; | 149 base::MessageLoop message_loop_; |
149 scoped_refptr<TestServiceDiscoveryClient> test_service_discovery_client_; | 150 scoped_refptr<TestServiceDiscoveryClient> test_service_discovery_client_; |
150 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_; | 151 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_; |
151 scoped_ptr<PrivetLocalPrinterLister> local_printer_lister_; | 152 scoped_ptr<PrivetLocalPrinterLister> local_printer_lister_; |
152 net::TestURLFetcherFactory fetcher_factory_; | 153 net::TestURLFetcherFactory fetcher_factory_; |
153 StrictMock<MockLocalPrinterListerDelegate> delegate_; | 154 StrictMock<MockLocalPrinterListerDelegate> delegate_; |
154 }; | 155 }; |
(...skipping 22 matching lines...) Expand all Loading... |
177 EXPECT_CALL(delegate_, LocalPrinterChanged(true, kServiceName, false, _)); | 178 EXPECT_CALL(delegate_, LocalPrinterChanged(true, kServiceName, false, _)); |
178 | 179 |
179 EXPECT_TRUE(SuccessfulResponseToURL( | 180 EXPECT_TRUE(SuccessfulResponseToURL( |
180 GURL(kPrivetInfoURL), | 181 GURL(kPrivetInfoURL), |
181 std::string(kInfoIsNotLocalPrinter))); | 182 std::string(kInfoIsNotLocalPrinter))); |
182 }; | 183 }; |
183 | 184 |
184 } // namespace | 185 } // namespace |
185 | 186 |
186 } // namespace local_discovery | 187 } // namespace local_discovery |
OLD | NEW |