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 // This test is relatively complicated. Here's the summary of what it does: | 5 // This test is relatively complicated. Here's the summary of what it does: |
6 // | 6 // |
7 // - Set up mock D-Bus related objects to mock out D-Bus calls. | 7 // - Set up mock D-Bus related objects to mock out D-Bus calls. |
8 // - Set up a mock proxy resolver to mock out the proxy resolution. | 8 // - Set up a mock proxy resolver to mock out the proxy resolution. |
9 // - Create ProxyResolutionServiceProvider by injecting the mocks | 9 // - Create ProxyResolutionServiceProvider by injecting the mocks |
10 // - Start the service provider. | 10 // - Start the service provider. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 // dbus_message_new_method_return() won't emit a warning. | 255 // dbus_message_new_method_return() won't emit a warning. |
256 method_call->SetSerial(1); | 256 method_call->SetSerial(1); |
257 // Run the callback captured in MockExportMethod(). In addition to returning | 257 // Run the callback captured in MockExportMethod(). In addition to returning |
258 // a response that the caller will ignore, this will send a signal, which | 258 // a response that the caller will ignore, this will send a signal, which |
259 // will be received by |on_signal_callback_|. | 259 // will be received by |on_signal_callback_|. |
260 resolve_network_proxy_.Run( | 260 resolve_network_proxy_.Run( |
261 method_call, | 261 method_call, |
262 base::Bind(&ProxyResolutionServiceProviderTest::OnResponse, | 262 base::Bind(&ProxyResolutionServiceProviderTest::OnResponse, |
263 base::Unretained(this))); | 263 base::Unretained(this))); |
264 // Wait for a response. | 264 // Wait for a response. |
265 while (!response_received_) { | 265 if (!response_received_) { |
Paweł Hajdan Jr.
2011/12/01 09:24:48
nit: Remove the braces too, {}.
Vince Laviano
2011/12/01 21:53:30
Done.
| |
266 message_loop_.Run(); | 266 message_loop_.Run(); |
267 } | 267 } |
268 // Return response. | 268 // Return response. |
269 return response_.release(); | 269 return response_.release(); |
270 } | 270 } |
271 | 271 |
272 // Receives a response and makes it available to MockCallMethodAndBlock(). | 272 // Receives a response and makes it available to MockCallMethodAndBlock(). |
273 void OnResponse(dbus::Response* response) { | 273 void OnResponse(dbus::Response* response) { |
274 response_.reset(response); | 274 response_.reset(response); |
275 response_received_ = true; | 275 response_received_ = true; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 ASSERT_TRUE(response.get()); | 323 ASSERT_TRUE(response.get()); |
324 dbus::MessageReader reader(response.get()); | 324 dbus::MessageReader reader(response.get()); |
325 ASSERT_FALSE(reader.HasMoreData()); | 325 ASSERT_FALSE(reader.HasMoreData()); |
326 | 326 |
327 // Confirm that the signal is received successfully. | 327 // Confirm that the signal is received successfully. |
328 // The contents of the signal are checked in OnSignalReceived(). | 328 // The contents of the signal are checked in OnSignalReceived(). |
329 ASSERT_TRUE(signal_received_successfully_); | 329 ASSERT_TRUE(signal_received_successfully_); |
330 } | 330 } |
331 | 331 |
332 } // namespace chromeos | 332 } // namespace chromeos |
OLD | NEW |